[TC 11.01] Help - Regular expressions: Wrong examples for look behind searches

Bug reports will be moved here when the described bug has been fixed

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
white
Power Member
Power Member
Posts: 4623
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

[TC 11.01] Help - Regular expressions: Wrong examples for look behind searches

Post by *white »

[Help - Regular expressions] wrote:
Look ahead/behind

A condition that text must be followed or preceded by other text, which is then not part of the result.
Negative look ahead:
 q(?!u)
Positive look ahead:
 q(?=u)
Negative look behind:
 (?<!q)u
Positive look behind:
 (?<=q)u
Find a 'q' not followed by an 'u'
matches the 'q' in "Iraq" but not in "question"
Find a 'q' followed by an 'u':
matches the 'q' in "question" but not in "Iraq"
Find an 'u' without a 'q' in front of it:
matches the 'u' in "Iraq" but not in "question"
find an 'u' with a 'q' in front of it:
matches the 'u' in "question" but not in "Iraq"

Important note:
The used regex library has a limitation that look ahead must be at the end of the regular expression, and look behind must be at the start. Otherwise an error will be shown.
matches the 'u' in "Iraq" :?:
doesn't match the 'u' in "Iraq" :?:

The u in Iraq must be buried deep, because I don't see it ;)
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48088
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [TC 11.01] Help - Regular expressions: Wrong examples for look behind searches

Post by *ghisler(Author) »

Looks like a copy and paste error. I think it should be like this:

Negative look behind: Find a 'q' without an 'a' in front of it:
(?<!a)q matches the 'q' in "question" but not in "Iraq"
Positive look behind: find a 'q' with an 'a' in front of it:
(?<=a)q matches the 'q' in "Iraq" but not in "question"
Author of Total Commander
https://www.ghisler.com
User avatar
white
Power Member
Power Member
Posts: 4623
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: [TC 11.01] Help - Regular expressions: Wrong examples for look behind searches

Post by *white »

ghisler(Author) wrote: 2023-09-12, 09:11 UTC Looks like a copy and paste error. I think it should be like this:
👍
User avatar
Sir_SiLvA
Power Member
Power Member
Posts: 3299
Joined: 2003-05-06, 11:46 UTC

Re: [TC 11.01] Help - Regular expressions: Wrong examples for look behind searches

Post by *Sir_SiLvA »

white wrote: 2023-09-11, 22:31 UTC The u in Iraq must be buried deep, because I don't see it ;)
Probably as deep as the chemical weapons :D
Hoecker sie sind raus!
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48088
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [TC 11.01] Help - Regular expressions: Wrong examples for look behind searches

Post by *ghisler(Author) »

This should be fixed in Total Commander 11.02 RC1, please test it!
Author of Total Commander
https://www.ghisler.com
User avatar
white
Power Member
Power Member
Posts: 4623
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: [TC 11.01] Help - Regular expressions: Wrong examples for look behind searches

Post by *white »

English help is good:
Negative look behind: Find a 'q' without an 'a' in front of it:
(?<!a)q matches the 'q' in "question" but not in "Iraq"
Positive look behind: find a 'q' with an 'a' in front of it:
(?<=a)q matches the 'q' in "Iraq" but not in "question"
German help is bad:
Negativer Blick nach hinten: Sucht ein 'q' ohne ein 'a' davor:
(?<!a)q findet das 'q' in "Iraq" aber nicht in "Qual"
Positiver Blick nach hinten: Sucht ein 'q' mit einem 'a' davor:
(?<=a)q findet das 'q' in "Qual" aber nicht in "Iraq"
User avatar
white
Power Member
Power Member
Posts: 4623
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: [TC 11.01] Help - Regular expressions: Wrong examples for look behind searches

Post by *white »

Tested Ok using TC 11.02rc2.

Moderator message from: white » 2023-10-11, 19:17 UTC

Moved to Fixed bugs.
Post Reply