I have a Macro that does an RE Replace. Keeps digits (0-9) plus CR and LF. It strips everything but digits from data.
Replace: [\x00-\x09\x0B-\x0C\x0E-/:-ÿ]
With: nothing
I'd forgotten how I made this happen, but fortunately I documented it in the Macro Description.
I tried to do this RE Replace, while it's keeping 0-9 and CR and LF, it is wiping out A-Z, which I want to keep.
Replace: [\x00-\x09\x0B-\x0C\x0E-/:-@\[-ÿ]
With: nothing
To keep from going blind, let me break it out. There are a series of ranges I'm trying to replace with nothing.
\x00-\x09
\x0B-\x0C
\x0E-/
:-@
\[-ÿ
Expounding on a RE isn't working
Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard
Expounding on a RE isn't working
(2[Bb]|[^2].|.[^Bb])
That is the question.
That is the question.
-
ben_josephs
- Posts: 2464
- Joined: Sun Mar 02, 2003 9:22 pm
You forgot about the lower-case letters.
Your character set expressions specify a set of characters that includes the lower-case letters (but not the upper-case letters).
So if Match case is selected they match lower-case letters (but not upper-case letters).
And if Match case is not selected they match both lower-case and upper-case letters.
If you want to use this technique to match neither lower- nor upper-case letters, you need to exclude both from the character set:
[\x00-\x09\x0B-\x0C\x0E-\x2F\x3A-\x40\x5B-\x60\x7B-\xFF]
which works whether Match case is selected or not.
But this is extremely obscure. It would be considerably clearer if you specifed explicitly what you don't want to match:
[^\n\r0-9A-Za-z]
Your character set expressions specify a set of characters that includes the lower-case letters (but not the upper-case letters).
So if Match case is selected they match lower-case letters (but not upper-case letters).
And if Match case is not selected they match both lower-case and upper-case letters.
If you want to use this technique to match neither lower- nor upper-case letters, you need to exclude both from the character set:
[\x00-\x09\x0B-\x0C\x0E-\x2F\x3A-\x40\x5B-\x60\x7B-\xFF]
which works whether Match case is selected or not.
But this is extremely obscure. It would be considerably clearer if you specifed explicitly what you don't want to match:
[^\n\r0-9A-Za-z]
-
ben_josephs
- Posts: 2464
- Joined: Sun Mar 02, 2003 9:22 pm