Page 1 of 1

how to search chains with and without carridge returns ?

Posted: Fri Jul 01, 2011 9:07 am
by patrmich
Hi,
I would like to search an replace a chain in in several files, where suche files may not have the same carridge returns.
In other words, I would like to search simultaneously both :

test
example

and

test example

Is there a way to do it ?
Thank you in advance for any reply.
Patrick

Re: how to search chains with and without carridge returns ?

Posted: Fri Jul 01, 2011 10:36 pm
by Fool4UAnyway
You can use the alternation operator, the pipe symbol: |

Regular expression:
wordA( |\r\n)wordB

This searches for "wordA wordB" as well as "wordA
wordB".

Perhaps the following regular expression suits your needs as well, in a more flexible way:
wordA *(\r\n)?wordB

This searches for wordA, any amount of space characters without requiring any, a single linebreak if present, then wordB.