regex

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?
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.
@helios, it is about 'regex' and the 'regex' is nested in database language. So you can not solve it with cpp STL.
closed account (48bpfSEw)
It's hard to understand what you mean. Could you show us the source code where the problem is, please?
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.