RegExp: Lookaround doesn't support? -- look ahead / look behind regular expressions don't work

English support forum

Moderators: white, sheep, Hacker, Stefan2

User avatar
Ovg
Power Member
Power Member
Posts: 664
Joined: 2014-01-06, 16:26 UTC
Location: MOW

RegExp: Lookaround doesn't support? -- look ahead / look behind regular expressions don't work

Post by *Ovg »

Hi all RegExp Guru! :-)

I got an error :

Code: Select all

Invalid file name specified! 
^((?!_h).)*$

TRegExprW(comp): Urecognized Modifier (pos 7)
What am I do wrong? This is a bug of feature? :D
https://yadi.sk/i/eco-pCGbAY7iAw

This RegExp working fine in UltraEdit

TC 9.21a x86/x64
Last edited by Ovg on 2018-10-31, 19:04 UTC, edited 3 times in total.
It's impossible to lead us astray for we don't care even to choose the way.
#259941, TC 10.00 x64, Windows 7 SP1 x64
User avatar
Horst.Epp
Power Member
Power Member
Posts: 4425
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: Bug in regexp engine?

Post by *Horst.Epp »

Your link doesn't work.
So what are you doing in TC to get that error ?
Windows 10 Home x64 Version 21H2 (OS Build 19044.1237)
TC 10.00 x64 / x86
Everything 1.5.0.1276a (x64)
User avatar
Ovg
Power Member
Power Member
Posts: 664
Joined: 2014-01-06, 16:26 UTC
Location: MOW

Re: Bug in regexp engine?

Post by *Ovg »

I'm trying to search for files using regexp
https://yadi.sk/i/eco-pCGbAY7iAw
It's impossible to lead us astray for we don't care even to choose the way.
#259941, TC 10.00 x64, Windows 7 SP1 x64
User avatar
Horst.Epp
Power Member
Power Member
Posts: 4425
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: Bug in regexp engine?

Post by *Horst.Epp »

Ovg wrote: 2018-10-31, 17:34 UTC I'm trying to search for files using regexp
https://yadi.sk/i/eco-pCGbAY7iAw
Lets see what RegEx experts or Christian say.
Works at least using Everything syntax.
Go to the starting dir and enter
ed:regex:^((?!_h).)*$
Last edited by Horst.Epp on 2018-10-31, 19:29 UTC, edited 2 times in total.
Windows 10 Home x64 Version 21H2 (OS Build 19044.1237)
TC 10.00 x64 / x86
Everything 1.5.0.1276a (x64)
User avatar
Ovg
Power Member
Power Member
Posts: 664
Joined: 2014-01-06, 16:26 UTC
Location: MOW

Re: Bug in regexp engine?

Post by *Ovg »

It seems look ahead / behind doesn't support?
It's impossible to lead us astray for we don't care even to choose the way.
#259941, TC 10.00 x64, Windows 7 SP1 x64
User avatar
Stefan2
Power Member
Power Member
Posts: 3294
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: Bug in regexp engine?

Post by *Stefan2 »

Ovg wrote: 2018-10-31, 18:41 UTC It seems look ahead / behind doesn't support?
That's right, it's not supported by the RE-engine TC uses. For more info search the forum for 'lookaround'




 
User avatar
Ovg
Power Member
Power Member
Posts: 664
Joined: 2014-01-06, 16:26 UTC
Location: MOW

Re: Bug in regexp engine?

Post by *Ovg »

Ok. Thank you!
I will change topic name.
It's impossible to lead us astray for we don't care even to choose the way.
#259941, TC 10.00 x64, Windows 7 SP1 x64
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 41541
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Lookaround doesn't support?

Post by *ghisler(Author) »

Sorry, the used RegEx engine doesn't support it.
Author of Total Commander
http://www.ghisler.com
User avatar
Ovg
Power Member
Power Member
Posts: 664
Joined: 2014-01-06, 16:26 UTC
Location: MOW

Re: Lookaround doesn't support?

Post by *Ovg »

ghisler(Author)
Thank you for confirming this!
It's impossible to lead us astray for we don't care even to choose the way.
#259941, TC 10.00 x64, Windows 7 SP1 x64
alexblade
Junior Member
Junior Member
Posts: 19
Joined: 2012-02-07, 09:24 UTC
Contact:

Re: RegExp: Lookaround doesn't support? -- look ahead / look behind regular expressions don't work

Post by *alexblade »

HI guys
I have the same error

TRegExpr: Unrecognized modifier

as understand , this is because TC is using an old (not popular) TRegExp engine by Andrey V. Sorokin [ http://regexpstudio.com/ also is no more supported ]

may be Author can change regex engine to PCRE ? or may be you know how I can change it for Lister ?

and second question how I should edit my pattern to avoid error and have correct result ?

Code: Select all

:\/\/(?!.*www\.google)\S{6}
thank you
User avatar
tuska
Power Member
Power Member
Posts: 2508
Joined: 2007-05-21, 12:17 UTC

Re: RegExp: Lookaround doesn't support? -- look ahead / look behind regular expressions don't work

Post by *tuska »

Hi,
alexblade wrote:TRegExp engine by Andrey V. Sorokin [ http://regexpstudio.com/ also is no more supported ]
TRegExpr by Andrey V. Sorokin is supportet: https://regex.sorokin.engineer/

'Everything' uses 'Perl Compatible Regular Expressions (PCRE)' and can be used for search queries in TC (see my signature).
See also point 3. RegEx - Regular Expressions from "Search queries: TC <=> 'Everything'" (link in signature).

Regarding RegEx-code, I'm afraid I can't help you.


Windows 10 Pro (x64) Version 1909 (OS build 18363.836)
TC 9.51 x64/x86 | 'Everything'-Version 1.4.1.983 (x64)
☑ 'Everything' | Search queries: TC <=> 'Everything'
narium
New Member
New Member
Posts: 1
Joined: 2021-03-16, 14:12 UTC

Re: RegExp: Lookaround doesn't support? -- look ahead / look behind regular expressions don't work

Post by *narium »

I have the same problem (TC 9.51 64bit), I tried to use the negative lookbehind as explained in https://regex.sorokin.engineer/en/latest/regular_expressions.html#assertions
but the exact example from the TRegExpr gave the "TRegExpr(comp): Urecognized Modifier (pos 7)" error.

Is this an error of TRegExpr or of TotalCommander? Is the TRegExpr library in TC up to date?
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 41541
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: RegExp: Lookaround doesn't support? -- look ahead / look behind regular expressions don't work

Post by *ghisler(Author) »

The TRegExpr library does not support look ahead or look behind. It is no longer maintained.
Author of Total Commander
http://www.ghisler.com
User avatar
elgonzo
Power Member
Power Member
Posts: 840
Joined: 2013-09-04, 14:07 UTC

Re: RegExp: Lookaround doesn't support? -- look ahead / look behind regular expressions don't work

Post by *elgonzo »

ghisler(Author) wrote: 2021-03-16, 20:38 UTC The TRegExpr library does not support look ahead or look behind. It is no longer maintained.
That's not quite true.

The current TRegExpr library does support lookahead and lookbehind assertions (as the post you responded to already pointed out: https://regex.sorokin.engineer/en/latest/regular_expressions.html#assertions).

And it is still (again?) being maintained (https://github.com/andgineer/TRegExpr). Dunno, maybe the project was on hiatus for some time, but it seems the library is being maintained on Github for at least the last 3..4 years again.

Also, according to the man himself (Andrey Sorokin, also owner of the TRegExpr Github repo), TRegExpr has become part of Lazarus (as per the readme.md on Github).

I haven't gone through the history of the Github repo in detail, but at first glance it appears assertions were included in TRegExpr around 2019~2020, i guess...
Windows 7 Pro x64 SP1
Post Reply