Active Forums => Programs => Topic started by: SpriggsySpriggs on June 01, 2021, 04:45:43 pm
Title: regex in QB64 using "tiny-regex-c" library
Post by: SpriggsySpriggs on June 01, 2021, 04:45:43 pm
I was looking for a regex library for QB64 and found one on GitHub here (https://github.com/kokke/tiny-regex-c). I compiled the object file and was able to use it in QB64 successfully. The "re_match" function should really be the only function you need from that library. According to the GitHub page, you should be able to do most basic regex operations. I'm not too familiar with regex myself but I know some of you out there definitely are.
DimAsString string_to_search: string_to_search ="It was sold for $1"
match = regex_match("\$\d", string_to_search,_Offset(match_length))'regex_match returns the character position (zero based) if it finds the match or -1 on failure. match_length will store the size of the string that matches the expression
The object file that you will need: And the header file:
Title: Re: regex in QB64 using "tiny-regex-c" library
Post by: SpriggsySpriggs on June 02, 2021, 09:23:01 am
My first post was incorrect as you do not only need the object file for this library. You actually need both the header and the object file. I've attached the header file to the original post.