Or in regular expression unable to use in search
-
Hi,
I am unable to use | in regular expression while searching two string ie (string 1|string 2)in search…does any one know why it’s not coming ?? -
It works fine.
For anybody to say what is going wrong for you, you’d have to present some data and a search regex.
We’re not mind-readers here. -
- in find I am giving regex as (dog | cat)
2.opted for regular expression
3.selecting find all in current document
4.in search result getting 0 matches
But dog and cat are present in my text file
- in find I am giving regex as (dog | cat)
-
Hard to tell what you are REALLY doing from that.
It appears you have extra space characters in there maybe?
Maybe you have(dog | cat)
instead of(dog|cat)
?
Spaces ARE significant in regular expressions, unless you use the(?x)
option in front, e.g.(?x)(dog | cat)
Anyway, alternation (the
|
regex operator) definitely works fine:I dropped the wrapping parentheses for the example, but it works just as well with them as without them.