Best method for searching string with regular expressions

Apr 9, 2013 at 8:15pm
Hello all,

I am attempting to search a target sequence that utilizes regular expressions (wildcards, etc.), and determine whether there is a match for my input pattern.

As an example:

Target Sequence: "*dogs*"
Pattern: "There are many dogs."

This match/check should return true, since the target sequence would include anything with "dogs" in it.

I have not been able to determine whether a target sequence can include regular expressions as a basic_regex can, so I am not sure if I'd be able to use regex.

Additionally: I have been unable to determine the required parameters for regex, so I've been working with the only example included in the regex_match explanation. Does anybody know of any additional documentation out there that could clear this up for me?

Best Regards,

George
Apr 9, 2013 at 10:08pm
I think you have terms wrong. "Target" is text. "Pattern" is a regular expression that may or may not be found from within target.

There are more than one definition for regular expression syntax.
http://www.cplusplus.com/reference/regex/regex_constants/
Apr 9, 2013 at 11:17pm
Thanks keskiverto. What I am trying to do is the following:

I have a file, which includes a list of items that utilize regular expressions (i.e. *.list;*.log;*.txt). I then need to verify whether a specific string matches an entry in this file, taking into account the wildcards in the file:

"abc.list" match = true
"123.logs" match = false

Sorry if I've confused the terms.
Apr 10, 2013 at 5:24am
Those are not "regular expressions". They are filename-matching wildcards / globs. There is more than one glob syntax, just like there are several regexp syntax.
http://stackoverflow.com/questions/1214930/win32-api-to-do-wildcard-string-match
Topic archived. No new replies allowed.