Reputation: 13213
How do I write a regular expression in where clause to match the following patterns
Pattern 1
~
~ ~
~ ~ ~
Pattern 2
~ ~ |A~b
~ ~ ~|A~b~c
~ ~ ~|this can be anything
~ ~ ~ ~ ~ ~|this can be anything
For pattern 2 just need to match the part before |.
Upvotes: 1
Views: 210
Reputation: 67968
^~([ ]+~)*[ ]*(\\|.*|$)
Try this.If you have space before first ~
use
^[ ]*~([ ]+~)*[ ]*(\\|.*|$)
See demo.
http://www.sqlfiddle.com/#!2/b67085/3/0
Upvotes: 1