regex

Jul 25, 2016 at 2:27am
I want to query a database, I use 'regex' to implement some 'Contain' query.
Such as, if a field is '111^111'

1) If the query condition is '1', the result is '111^111'
2) If the query condition is '11', the result is '111^111'
3) If the query condition is '111', the result is '111^111'
4) If the query condition is '111^', the result is null, because '^' is special character.


I do not want to do special process for all special characters.
Who can give a simple method?
Jul 25, 2016 at 5:37am
If you only want to check if string A is a substring of string B, just use common string functions. For example, B.find(A) != B.npos.
Jul 25, 2016 at 7:44am
@helios, it is about 'regex' and the 'regex' is nested in database language. So you can not solve it with cpp STL.
Jul 25, 2016 at 7:51am
closed account (48bpfSEw)
It's hard to understand what you mean. Could you show us the source code where the problem is, please?
Jul 25, 2016 at 10:40am
it is about 'regex' and the 'regex' is nested in database language.

So what does this have to do with C++? Surely the "database language" has a simpler search in addition to the pattern processing. But we don't know because "database language" isn't C++, is it? ;)
Topic archived. No new replies allowed.