I'm now facing a trouble in building a SQL regex searching at runtime.
Somewhat its like:
- User inputs searching string ( one ? represents for 1 character [a-z0-9]):
AA?001
Data:
AAA001
AAB001
AA7001
AA70012
AB0001
Result:
AAA001
AAB001
AA7001
At first, I was thinking about the way that splitting it by [+?], then the conditions will be something like:
Startwith('AA') AND Endwith("001") AND LENGTH = 5)
But this way is not gonna work with pattern: A?0?1. So, I would probably have to build a Regex at runtime, but do not have any clue to do that.
Any suggest/idea/recommend would be grateful.
AA.001? Add anchors if necessary,^AA.001$