Multi Commander Support Forum
Multi Commander => Support and Feedback => Topic started by: amenu on September 14, 2015, 06:09:21
-
I just started using MC and am learning as I go along. I wanted to use file find to find filenames that had both of two words in them -- i.e., word1 and word2, not word1 or word2. I looked in the online documentation but did not see the answer. Where can I find this information.
-- Arthur
-
Probably you should use RegEx like
(.*)(word1)(.*)(word2)(.*)
to search for word1 followed by word2
or
(.*)(word1|word2)(.*)(word2|word1)(.*)
to ignore order
-
I am not familiar with RegEx codes. Where is there an instruction manual where I can learn how to use RegEx?
-- Arthur
-
Basic info coud be found here (https://en.wikipedia.org/wiki/Regular_expression)
-
I've looked at the Wikipedia article and have a sense of how RegEx works. Would not the second expression you gave:
Code: [Select]
(.*)(word1|word2)(.*)(word2|word1)(.*)
select the files I am looking for (files that have both word1 and word2 in any order in their filenames) but also select files with two occurrences of word1 and no occurrences of word2, or two occurrences of word2 and no occurrences of word1?
I am thinking ((.*)(word1)(.*)(word2)(.*))|((.*)(word2)(.*)(word1)(.*)) would give me just those files that have both word1 and word2 in any order in their filenames.
I am ready to be corrected, as I am obviously unschooled in RegEx.
-- Arthur
-
You're probably right.
-
This is a useful free regex tester
http://antix.co.uk/Projects/Regex-Tester (http://antix.co.uk/Projects/Regex-Tester)
If you want to go further with Regex this is a good place to look
http://www.regular-expressions.info/jgsoft.html (http://www.regular-expressions.info/jgsoft.html)
Some good regex progs as well (but paid-for).
-
I'm not an expert in RegEx
but this worked for me.. it requires that that word1 and word2 exist in the file in both orders (first word1 and then word2, or word2 and then word1)
Might get messy if more then two is used. But there must be some better regex trick for that
(.*word1.*word2.*|.*word2.*word1.*)