blog: regular expression in file search

Discussion & Support for xplorer² professional

Moderators: fgagnon, nikos, Site Mods

User avatar
nikos
Site Admin
Site Admin
Posts: 16295
Joined: 2002 Feb 07, 15:57
Location: UK

blog: regular expression in file search

Post by nikos »

here's the comment area for today's blog post found at
http://zabkat.com/blog/regular-expression-search.htm
Kilmatead
Platinum Member
Platinum Member
Posts: 4797
Joined: 2008 Sep 30, 06:52
Location: Baile Átha Cliath

Re: blog: regular expression in file search

Post by Kilmatead »

Nikos wrote:...note that xplorer² regexp syntax isn't 100% PERL compatible
Yeah, try "significantly less than that" - on top of this obvious goof, x2 also has no concept at all of quantifiers, as in a{n} (to match 'a' n times), or quantifier ranges a{n,m} (match 'a' n to m times, but not less than n or more than m), etc, etc.

In fact, x2 completely ignores (or interprets literally) the quantifier {} brackets, no matter if 'lazy' or 'greedy' syntax is used. Type such a perfectly normal (and ridiculously common) regex into any other file manager (yes, I tested) and it works fine. x2? No, no, no. Try searching GUID names with "\{[a-f\d]{8}-([a-f\d]{4}-){3}[a-f\d]{12}\}". Ding! Please go to the end of the line, sir, this merry-go-round is not for you. :cry:

In case you're wondering how I found this, I was trying to find a real-world way to solve this recent user question, and I figured using regex to find 2 (and only 2) backslashes in the Path [S] column would be a perfect way to target specific subfolder tiers by counting the escaped \\'s in the string. But no, not to be. What good is being a clever monkey if you're thwarted and undermined at every corner by an unreliable engine?

Broken, dude. Broken. Exactly what use is regex (in x2) if the results cannot be trusted because the unknown-engine is "undocumentedly erratic" about what it supports and what it doesn't? I'm not talking far-out esoterica here, these are common rules found in any google search when asking "I want a regex to solve <x>"...

The strange pass-the-buck excuse you used previously ("the regexp implementation is wholly outside xplorer2 and I cannot change it") sounds like waffle to me - if you put it in in the first place, you can change it to another one that actually works as advertised - this is not a "I blame the API" kind of problem, this is "Sorry, I shop at K-Mart and get all my stock from my buddy Guido in the back".
Tuxman
Platinum Member
Platinum Member
Posts: 1683
Joined: 2009 Aug 19, 07:49

Re: blog: regular expression in file search

Post by Tuxman »

Maybe a detailed list of non-PCRE compatibility issues of x² would help some. "x² uses regex but not quite PCRE" doesn't tell much about what to do for certain tasks.
Also, while it's true that "almost PCRE" (as in PHP) is a standard, many other people use .net regex or the Vim syntax or one of the multiple others.

Why can't people just decide on one single syntax?
Tux. ; tuxproject.de
registered xplorer² pro user since Oct 2009, ultimated in Mar 2012
RightPaddock
Gold Member
Gold Member
Posts: 428
Joined: 2011 Jan 23, 18:58
Location: Sydney AU

Re: blog: regular expression in file search

Post by RightPaddock »

To be fair to nikos the blog post does have this para
Finally note that xplorer² regexp syntax isn't 100% PERL compatible at present. For the next version I am considering switching to the DEELX regexp engine that proved decent in performance tests and it is closer to the syntax most people would consider "standard".
Perhaps those who know about these things are aware of other FOSS libraries that nikos ought to consider. The blog post where nikos 'hinted' he was considering DEELX attracted surprisingly little comment. Here's WikiP's Comparison of regular expression engines

That said, perhaps it would have been better to let this blog item to sit on the shelf pending the inclusion of a better regex engine into X2. Or is this blog post a hint that the next release of X2 will incorporate the DEELX engine; when the trumpet will blow again, and we'll all stand, throwing our hats into the air crying out hip huzzar, hip huzzar….

BR
Windows 10 Pro (64 bit) version 1809 - Xplorer2 version: Pro 2.5.0.4 [Unicode] x64 2014-06-21
User avatar
nikos
Site Admin
Site Admin
Posts: 16295
Joined: 2002 Feb 07, 15:57
Location: UK

Re: blog: regular expression in file search

Post by nikos »

it's not that bad. Instead of the repetition operator you can just copy-paste-repeat whatever you need. The expression will look funny but will work the same. Regular expressions are not renowned for their clarity
Kilmatead
Platinum Member
Platinum Member
Posts: 4797
Joined: 2008 Sep 30, 06:52
Location: Baile Átha Cliath

Re: blog: regular expression in file search

Post by Kilmatead »

Finally note that xplorer² regexp syntax isn't 100% PERL compatible at present. For the next version I am considering switching to the DEELX regexp engine that proved decent in performance tests and it is closer to the syntax most people would consider "standard".
Speaking of the lunatic workaround solution offered here, since we're now in "the next version" I take it you forgot to actually implement a useful and syntactically-working variant of RegEx? It's not like the DEELX project would break the bank...

<Oh please let me not see tumbleweeds blowing past...>

<Oh, look, tumbleweeds... and spiders... and... what the heck is that thing... oh lord it's... it's... aaarrggghh!!!!>

:cry:

Another life snuffed out too early for want of a non-broken RegEx implementation.
namsupo
Member
Member
Posts: 49
Joined: 2007 Aug 29, 02:02

Re: blog: regular expression in file search

Post by namsupo »

You and Nikos really are the odd couple, aren't you? :)
User avatar
nikos
Site Admin
Site Admin
Posts: 16295
Joined: 2002 Feb 07, 15:57
Location: UK

Re: blog: regular expression in file search

Post by nikos »

if it makes you happier DEELX is working inside deskrule for more standard (but perhaps slower) regular expressions
Kilmatead
Platinum Member
Platinum Member
Posts: 4797
Joined: 2008 Sep 30, 06:52
Location: Baile Átha Cliath

Re: blog: regular expression in file search

Post by Kilmatead »

namsupo wrote:You and Nikos really are the odd couple, aren't you?
Everyone needs their own personal gadfly, don't they? Nikos never struck me as the type of guy to find humility within himself of his own free will (that would require clarity of vision, another thing he's not especially known for) - as his wife discovered with marriage, he has to be dragged kicking and screaming from one safety net to another. :wink:
nikos wrote:if it makes you happier DEELX is working inside deskrule for more standard (but perhaps slower) regular expressions
You've been sending me betas of this bloody thing to break for a year now and you only get around to mentioning this today? I gave up trying to use RegEx with your stuff because virtually all examples one finds on the 'net are perl-compatible-only, so learning-by-testing on real-world problems was a waste of time.

And now you tell me there was actually a paddle in the boat? An oasis in the desert? A salve for the wound? Crikey - you must really frighten the bejesus out of the teacher on parent/teacher night! :D

Bloody spider in Lord of the Rings had nothing on you.

You'd even make Chuck Norris cry.

But, while he can cry, the answer is yes it does make me happier. And (as far as I can tell from early morning tests) it seems to work, too.

Any progress with the extra-bits you missed before with the TC plugin thing?

Carthago delenda est!
User avatar
nikos
Site Admin
Site Admin
Posts: 16295
Joined: 2002 Feb 07, 15:57
Location: UK

Re: blog: regular expression in file search

Post by nikos »

what extra bits did i miss?
Kilmatead
Platinum Member
Platinum Member
Posts: 4797
Joined: 2008 Sep 30, 06:52
Location: Baile Átha Cliath

Re: blog: regular expression in file search

Post by Kilmatead »

That ADS plugin you pointed me at with the help-file wholly in Russian just to keep us on our toes (http://tirna.narod.ru/soft/files/tc_streams_plug.zip) that allows the definition of enumerated streams - DR didn't allow for the individual column definition so it just stops with "the first one only" provided, which isn't all that useful.

In TC you'd define a separate column from the plugin for Stream1, Stream2, etc (and they all work) - in DR you don't have that choice, you get Stream1 and nought else, not even an amalgamation.

See emails circa 12-Feb-15.