Something like....
/0x(?-i:[\da-f]{1,4})/
... should do the trick. Curlies are pretty slow, relatively speaking, though. You will achieve approximately equivalent results with
/0x(?-i:[\da-f]+)/
except that this will also match "0xdeadbeefcafe" and the like (which might be considered a feature).
Note that you do not want to use, as suggested elsewhere in this thread:
/0x[\da-f]{1,4}/i # or /0x[\da-f]+/i
...since that would allow 0X2a (note the uppercase X) which is not a legal hexadecimal definition.
• another intruder with the mooring in the heart of the Perl
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.