#53 closed defect (fixed)
Regular expressions 0[xX]?[0-9a-fA-F]+ and [0-9a-fA-F]+ don't find hex numbers that start with letters
Reported by: | Gregg Young | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | Release_1.1 |
Component: | Configuration | Version: | PreRelease_1.0 |
Keywords: | Cc: | Alfredo Fernández Díaz |
Description (last modified by )
Long story short: shortcoming in .TRP mode now fixed in changeset #185, as discussed through email.
Attachments (1)
Change History (15)
comment:1 Changed 4 years ago by
Summary: | Regular expressions 0[xX]?[0-9a-fA-F]+ and [0-9a-fA-F]+ doesn't fine hex numbers that start with letters → Regular expressions 0[xX]?[0-9a-fA-F]+ and [0-9a-fA-F]+ doesn't find hex numbers that start with letters |
---|
comment:2 Changed 4 years ago by
Summary: | Regular expressions 0[xX]?[0-9a-fA-F]+ and [0-9a-fA-F]+ doesn't find hex numbers that start with letters → Regular expressions 0[xX]?[0-9a-fA-F]+ and [0-9a-fA-F]+ don't find hex numbers that start with letters |
---|
comment:3 Changed 4 years ago by
Milestone: | Release_1.0 → Release_1.1 |
---|
comment:4 Changed 4 years ago by
Version: | → PreRelease_1.0 |
---|
comment:5 Changed 2 years ago by
I'm not sure what the problem is, I tried those expressions precisely and both work and find numbers in eFTE2 1.0 VIO and PM just fine -- AFAICT.
0[xX]?[0-9a-fA-F]+ should not find any hex number that does not start with "0"; [0-9a-fA-F]+ will match any hex number that does NOT have an X in it (or the part after the x, anyway).
I don't think [0-9a-fA-F]+ matching a-f letters 'every where they appear' is a problem: it should do so.
If you want to match hex numbers ONLY, take into account that numbers are not normally stuck-in in the middle of some text but surrounded by spaces just like words. I would try, for example, {\s|=}{0[xX]}?[0-9a-fA-F]+\s+ to match numbers between spaces (or right after an = sign) for starters. Then you can add punctuation signs, a decimal separator, other math operators, etc.
If I am mistaken or somehow misreading you, perhaps you can write a different example of unexpected behavior -- I am just trying to find what works and what does not.
comment:6 Changed 2 years ago by
OK, my previous example won't find numbers at the end of a line, because it expects to have at least one space after the figures, sorry about that. Not hard to fix, though:
{\s|=}{0[xX]}?[0-9a-fA-F]+{{\s|;}.*}?$
which will match most hex value assignments in programming code: when the number ends we may have anything (or nothing at all) before the end of line, but if there's anything, it must start with ";" or a blank character.
Of course, you need to be careful with those ".*"; f.e. in "1 + 2 = 3" the above will give three matches: each number plus the remainder of the line in each case.
comment:7 Changed 2 years ago by
Cc: | Alfredo Fernández Díaz added |
---|
comment:8 Changed 2 years ago by
This problem is in the highlighting code. .trp files have a bunch of hex in them and this is where I see this problem. The .trp file highlighting code is in the newest release of efte2. I am attaching a file that shows this problem. I tried your suggestions above but none of them solve the problem
Changed 2 years ago by
Attachment: | 0034_01.TRP added |
---|
comment:9 Changed 2 years ago by
Of course they didn't, because I had understood something different: that you were using those RegExps? with Find to look for numbers, and that too many 'false' positives were being highlighted (found) when searching again.
So, you have this colorize defined for .trp files where you want all hex numbers in a certain color, and your problem is, purely alphabetical hex numbers are not highlighted (as seen eFTEing your .trp file), and what you tried to make them light up also highlights all other sequences of a-f within the text, which you don't want. I can try to brush the .trp mode up a bit if you confirm we are on the same page now.
comment:10 Changed 2 years ago by
You are close to correct. The problem is it doesn't colorize hex numbers that start with a-f or A-F. Obviously I would like a solution that minimizes false positives (non numbers being colorized). Thanks
comment:11 Changed 2 years ago by
OK, I'll try. What hex numbers do you want to highlight and how? All, all except or only those (not) in specific (sub)sections (stack dump / addresses / dwords/ chars)? One color or several?
comment:13 Changed 2 years ago by
Description: | modified (diff) |
---|---|
Resolution: | → fixed |
Status: | new → closed |
comment:14 Changed 2 years ago by
Component: | eFTE core → Configuration |
---|
The problem is in the highlighting code. I can get the letters to work but the result is that then a-f get highlighted as numbers every where they appear. Probably not worth the hassle to figure out a work around. I did try {4,} in the string but it didn't seem to change anything.