Author Topic: Regex in Find Dialog broken?  (Read 12901 times)

Ulfhednar

  • Contributor
  • VIP Member
  • *****
  • Posts: 514
    • View Profile
Regex in Find Dialog broken?
« on: November 07, 2015, 10:36:38 »
I'm entering the following in the find dialog but cannot get it to work
e.g.
Find = *.txt
File Content= (?:word)
+switch= regexp
Returns nothing

Find = *.txt
File Content= word
+switch= (none)
Returns files containing 'word'

That form of regexp normally works or am I going mad again?
   :o
 ???

Mathias (Author)

  • Administrator
  • VIP Member
  • *****
  • Posts: 4488
    • View Profile
    • Multi Commander
Re: Regex in Find Dialog broken?
« Reply #1 on: November 07, 2015, 12:26:34 »
regex work. I'm not an regex expert, I never uses it. But there are a lot of different regex variations
MC is using the built in regex engine in C++, I think it is similar to the javascript regex, but not sure

This works for me.

substring   
 (.*str.*)

word     
 .*(\bword\b).*

wordone or wordtwo
.*(\bwordone\b|\bwordtwo\b).*


Ulfhednar

  • Contributor
  • VIP Member
  • *****
  • Posts: 514
    • View Profile
Re: Regex in Find Dialog broken?
« Reply #2 on: November 07, 2015, 18:28:21 »
OK Thanks Mathias.
I am giving it too many terms perhaps  - my entries have been based on c++ 2013
in a C++ example it would be inserted as -
std::regex re("(?:word)", std::regex_constants::icase);
I will try without the (?:
Hope the | works as I want to find multiple variable terms...  :P
Update
Yes I can make it work  ;D  Didn't like me using ?: I guess.
It passes the regex to the hi-lite & find fields in MDV, but MDV can't use it.
It would be useful if it could - is that beyond it's scope?
« Last Edit: November 07, 2015, 18:42:06 by Ulfhednar »