in reply to Re: Regular expression for hexadecimal number
in thread Regular expression for hexadecimal number
Hmm, this answers a question that's been in the back of my mind for a while, "Can you turn on/off modifiers in the middle of a regex."
Thanks for prompting me to pop over to Perldoc to learn about it.
A question, though: The goal is to keep the 0x case sensitive (to disallow 0X, as you said), but let the hex that follows match in a case insensitive way (i.e. match both 0xFF and 0xff)? If so, doesn't (?-i:PATTERN) actually turn off the insensitivity modifier (which wasn't on?). Based on my (probably wrong) interpretation of what I just learned at Perldoc, it seems like you'd want (?i:PATTERN) to turn it on.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Regular expression for hexadecimal number
by radiantmatrix (Parson) on Jul 30, 2007 at 15:13 UTC |