Find files with multiple Strings
I want to find all the files which has both the strings in any order.
string are; abc and def or def and abc.
The result should return only the files which has both the string in a file.
Maybe try something like this:
Hello, @vijay-s @alan-kilborn and All,
As @alan-kilborn, I’ve already used this method. However, it quickly becomes tedious if you increase the number of expressions :-((
I think, that this other formulation is stronger and can be easily used, even if more than two expressions to match !
).+( sensitive to case )
).+( insensitive to case )
For instance, the regex
(?i-s)^(?=.*abc)(?=.*def)(?=.*ghi)(?=.*jkl).+will find all files which have, at least, one line containing the four strings
jkl, in any order and whatever their case !
See also my in-development expressions for generic logic “gates” in regular expressions: AND, OR, XOR, NOR, NAND
Some day, they might get a blog post all of their own, rather than be buried in that thread. But they are still in-development, so they’ll stay there for now.