RegEx search by hex code

Please report only one bug per message!

Moderators: white, Hacker, petermad, Stefan2

Post Reply
citro
Junior Member
Junior Member
Posts: 2
Joined: 2011-08-02, 08:31 UTC

RegEx search by hex code

Post by *citro »

I am dealing with some binary files and I'm trying to search them using RegEx option.

In particular, I am searching for 0x00 (\x00) and 0x01 (\x01) char codes.

When I'm searching for \x00, I find nothing, but I also don't get the "Not found" alert box.

When I'm searching for \x01, I find lost of false positives (including 0x00s).
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

I think regex just thinks that \x00 is an empty search string.

For me, \x01 finds only zero bytes, no more false positives. It is an interesting thing that TC's regex finds \x00 when you type \x01! It looks like a way to find zero bytes, it even allows to find files that doesn't contain zero bytes!
citro
Junior Member
Junior Member
Posts: 2
Joined: 2011-08-02, 08:31 UTC

Post by *citro »

I think there is something wrong (a bug).

Searching 00 with "Search hex string" find all \x00 chars.
User avatar
white
Power Member
Power Member
Posts: 4593
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Post by *white »

User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Sorry, this is a limitation of the used regex library. Searching for 00 characters is not reliable. The library is meant for finding text in text files.
Author of Total Commander
https://www.ghisler.com
User avatar
MarkFilipak
Member
Member
Posts: 164
Joined: 2008-09-28, 01:00 UTC
Location: Mansfield, Ohio

Re: RegEx search by hex code

Post by *MarkFilipak »

Re: viewtopic.php?f=3&t=72997

Could you fix this, Christian? It appears that when '\x00' is in the pattern, the match is '\x00' plus the next byte. The search index is now off by 1 and the remainder of the pattern is not matched, even if it is there. This appears to happen only for '\x00' (and maybe only if it's the 1st byte but I don't have the source code and I don't have the patience to grope for more clues).
Hi Christian! Delighted customer since 1999. License #37627
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6449
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: RegEx search by hex code

Post by *Horst.Epp »

MarkFilipak wrote: 2020-10-12, 17:09 UTC Re: viewtopic.php?f=3&t=72997

Could you fix this, Christian? It appears that when '\x00' is in the pattern, the match is '\x00' plus the next byte. The search index is now off by 1 and the remainder of the pattern is not matched, even if it is there. This appears to happen only for '\x00' (and maybe only if it's the 1st byte but I don't have the source code and I don't have the patience to grope for more clues).
I guess you are not running TC version 7.56 or 7.57 :)
So hijacking an old thread make no sense for me.
Windows 11 Home x64 Version 23H2 (OS Build 22631.3374)
TC 11.03 x64 / x86
Everything 1.5.0.1371a (x64), Everything Toolbar 1.3.2, Listary Pro 6.3.0.69
QAP 11.6.3.2 x64
User avatar
MarkFilipak
Member
Member
Posts: 164
Joined: 2008-09-28, 01:00 UTC
Location: Mansfield, Ohio

Re: RegEx search by hex code

Post by *MarkFilipak »

Horst.Epp wrote: 2020-10-12, 17:42 UTC
MarkFilipak wrote: 2020-10-12, 17:09 UTC Re: viewtopic.php?f=3&t=72997

Could you fix this, Christian? It appears that when '\x00' is in the pattern, the match is '\x00' plus the next byte. The search index is now off by 1 and the remainder of the pattern is not matched, even if it is there. This appears to happen only for '\x00' (and maybe only if it's the 1st byte but I don't have the source code and I don't have the patience to grope for more clues).
I guess you are not running TC version 7.56 or 7.57 :)
So hijacking an old thread make no sense for me.
I'm running version 9.51. Does that really matter to you? It's still a problem. It's still the same problem.
Hi Christian! Delighted customer since 1999. License #37627
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6449
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: RegEx search by hex code

Post by *Horst.Epp »

MarkFilipak wrote: 2020-10-12, 19:08 UTC
Horst.Epp wrote: 2020-10-12, 17:42 UTC
MarkFilipak wrote: 2020-10-12, 17:09 UTC Re: viewtopic.php?f=3&t=72997

Could you fix this, Christian? It appears that when '\x00' is in the pattern, the match is '\x00' plus the next byte. The search index is now off by 1 and the remainder of the pattern is not matched, even if it is there. This appears to happen only for '\x00' (and maybe only if it's the 1st byte but I don't have the source code and I don't have the patience to grope for more clues).
I guess you are not running TC version 7.56 or 7.57 :)
So hijacking an old thread make no sense for me.
I'm running version 9.51. Does that really matter to you? It's still a problem. It's still the same problem.
It matters because I'm normaly not interested to read error reports for such old versions of TC
Windows 11 Home x64 Version 23H2 (OS Build 22631.3374)
TC 11.03 x64 / x86
Everything 1.5.0.1371a (x64), Everything Toolbar 1.3.2, Listary Pro 6.3.0.69
QAP 11.6.3.2 x64
User avatar
MarkFilipak
Member
Member
Posts: 164
Joined: 2008-09-28, 01:00 UTC
Location: Mansfield, Ohio

Re: RegEx search by hex code

Post by *MarkFilipak »

Horst.Epp wrote: 2020-10-12, 20:08 UTC It matters because I'm normaly not interested to read error reports for such old versions of TC
But I'm not reporting a problem "for such old versions of TC". I'm reporting a problem for the current version.

If you think I should do something different, what is it?
Hi Christian! Delighted customer since 1999. License #37627
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6449
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: RegEx search by hex code

Post by *Horst.Epp »

MarkFilipak wrote: 2020-10-12, 21:14 UTC
Horst.Epp wrote: 2020-10-12, 20:08 UTC It matters because I'm normaly not interested to read error reports for such old versions of TC
But I'm not reporting a problem "for such old versions of TC". I'm reporting a problem for the current version.

If you think I should do something different, what is it?
Look into the title of this Sub-Forum
It says TC7.56(a)/7.57 bug reports
There is a Forum for 9.5x bug reports.
Windows 11 Home x64 Version 23H2 (OS Build 22631.3374)
TC 11.03 x64 / x86
Everything 1.5.0.1371a (x64), Everything Toolbar 1.3.2, Listary Pro 6.3.0.69
QAP 11.6.3.2 x64
User avatar
MarkFilipak
Member
Member
Posts: 164
Joined: 2008-09-28, 01:00 UTC
Location: Mansfield, Ohio

Re: RegEx search by hex code

Post by *MarkFilipak »

Horst.Epp wrote: 2020-10-13, 08:33 UTC
MarkFilipak wrote: 2020-10-12, 21:14 UTC
Horst.Epp wrote: 2020-10-12, 20:08 UTC It matters because I'm normaly not interested to read error reports for such old versions of TC
But I'm not reporting a problem "for such old versions of TC". I'm reporting a problem for the current version.

If you think I should do something different, what is it?
Look into the title of this Sub-Forum
It says TC7.56(a)/7.57 bug reports
There is a Forum for 9.5x bug reports.
Oh. Forgive me. I was given a link to this thread. I didn't know its sub-forum was limited in any way.
Hi Christian! Delighted customer since 1999. License #37627
Post Reply