Unsupported \x00 and \x0000 in regex: Make either TC itself or the help file spell it out

Here you can propose new features, make suggestions etc.

Moderators: white, Hacker, petermad, Stefan2

Post Reply
gdpr deleted 6
Power Member
Power Member
Posts: 872
Joined: 2013-09-04, 14:07 UTC

Unsupported \x00 and \x0000 in regex: Make either TC itself or the help file spell it out

Post by *gdpr deleted 6 »

There are quite a few forum posts here where people stumbled over the \x00 and \x0000 issue with regex.
(The most recent one: https://www.ghisler.ch/board/viewtopic.php?f=3&t=72497 , but you can find more by simply searching the forum for "\x00")

While Christian has mentioned here somewhere in the forum that \x00 and \x0000 are not supported by TC's regex implementation, neither TC itself nor its help file provide any indication of it being not supported. Instead, a user trying to use \x00 in a regex search tearm is either confronted with a misleading error message saying the pattern hasn't been found, or the search function doesn't do anything.

The help file states:
Help file wrote: \xnn Character with hexadecimal code nn. Example: \x20 is the space character. The character table charmap.exe (if installed) shows the character code of most special characters. You can use the Windows calculator in scientific mode to convert from decimal to hex.

\x{nnnn} Unicode character with hexadecimal code nnnn. Note that Total Commander uses Unicode for file names, so you need to use this notation for characters not in your local codepage.
The \x00, \x0000 limitation does not seem to be mentioned anywhere in the help.

If TC's regex engine can't handle NUL characters reliably, ideally TC''s search function(s) should reject regex patterns containing NUL characters (\x00 or \x0000) while giving an informative clue to the user. Or, if this is deemed too costly, at least the help for the regular expression syntax itself should spell out this limitation at the same place (or near) where it is explaining \xnn and \xnnnn.
Post Reply