in reply to Re: Perl store as variables regex matches for use outside of loop.
in thread Perl store as variables regex matches for use outside of loop.
Regarding matching numbers ... I have recently gone back to using the old-school
/[0-9]+/
because of (in Using character classes)
Since the introduction of Unicode, unless the //a modifier is in effec +t, these character classes match more than just a few characters in t +he ASCII range. \d matches a digit, not just [0-9] but also digits from non-roman scri +pts
There are a lot of characters flying around out there. But some stuff still needs to be limited to ASCII -- for example book ref numbers, even if your book titles may have non-Roman characters; or a primary key from a database table in a multilingual CMS ...
So if you want to make sure you are matching only Roman script digits, and you need to work on perls older than 5.14, you should probably use the old [0-9]. If you have a new perl, you can do:
/\d+/a
which will limit the match to ASCII characters ...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Perl store as variables regex matches for use outside of loop.
by Laurent_R (Canon) on Jul 12, 2015 at 17:50 UTC |