Hi Folks,
I want to search for files that have string1 .or. string2 .or. string3 .or. ....
How to do? I could not find it in forum or I search for the wrong words
Is there a way to have a external table/array for the different search strings?
thanks a lot in advance
Greetings
Oknef
searching for a text array (logical .or.)
Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard
- s_reynisson
- Posts: 939
- Joined: Tue May 06, 2003 1:59 pm
thanks but doesn't work
think it is a problem with the separators for each string, and there is also no .or. possible, so maybe it can't work in textpad.
Say you have a range of strings as shown below
And want to find banana or juice then you need to use the regular expression shown below.
banana\|juice
This should extend to use in find in files
Code: Select all
banana potato chicken juice
banana\|juice
This should extend to use in find in files
-
- Posts: 2461
- Joined: Sun Mar 02, 2003 9:22 pm
It depends on whether you're using Posix regular expression syntax:
By default Posix syntax is not used. But if you expect to use any complex regular expressions, and if you hope to maintain your sanity, I strongly recommend Posix syntax.
If you're not, it's \|; if you are, it's |.Configuration | Preferences | Editor
[ ] Use POSIX regular expression syntax
By default Posix syntax is not used. But if you expect to use any complex regular expressions, and if you hope to maintain your sanity, I strongly recommend Posix syntax.
POSIX Differences
Checking the TP help file, there seem to be only two differences between POSIX and non-POSIX expression, the one above and {min,max}.If you're not, it's \|; if you are, it's |.
The OR expression above is certainly a lot simpler. Are there other factors that lead to POSIX being a better choice?
-
- Posts: 2461
- Joined: Sun Mar 02, 2003 9:22 pm
Also ( ... ). They're the real killers. Expressions with a lot of parenthesised subexpressions, especially nested ones, and especially when they contain other non-alphanumeric characters, quickly become unreadable with all those escaped parentheses. And it gets worse when you add yet more parentheses to capture subexpressions to use in replacement expressions.
Also, if you intend to get into Perl-style regexes, it's as well to get into the modern style of regex escaping early.
Also, if you intend to get into Perl-style regexes, it's as well to get into the modern style of regex escaping early.