Closed white-gthb closed 2 years ago
Subject string basically can be any string. The position found by earlier versions of TRegExp and other engines is at the end of the string. Some examples are given in the mentioned thread on the official forum of Total Commander.
I tried 2 first examples from TC forum
1.
Filename: 12345
Search for: (?:)
Replace with: -
1x: Disabled
Subst: Disabled
Result: -1-2-3-4-5
Expected result: -1-2-3-4-5-
executed replace in CudaText (it uses this engine). result is OK!
2.
Filename: 1234_text_ABCD
Search for: (_[a-zA-Z]+_)?
Replace with: __
1x: Disabled
Subst: Disabled
Result: __1__2__3__4____A__B__C__D
Expected result: __1__2__3__4____A__B__C__D__
executed in CudaText. OK again!
make sure that TCmd uses the LAST version of TRegexpr.
Thanks for testing! I will notify the author.
Author says latest trunk code seems to work.
so you can close this issue.
@andgineer Author of TotalCommander said that 'regexpr last release is from 2017' so he took that old code. Can you make the Github release?
Ok I am not sure what for but I created the release https://github.com/andgineer/TRegExpr/releases/tag/1.155
Thanks
Unlike in earlier versions, TRegExpr in certain cases no longer matches an zero-length match at the end of a string. Apparently some optimization was done to TRegExpr constituting to new behavior which I consider to be a bug.
Examples of effected regular expressions:
How this works out and where I first reported this can be read here: https://www.ghisler.ch/board/viewtopic.php?t=76139
In any case, this new behavior is not consistent with older versions of TRegExpr and seemingly all other regular expression engines.