Does this match any number or just single digit ones?

  • Thread starter Thomas Andersson
  • Start date
T

Thomas Andersson

Will this line update $page with a number if it's double digit (ie 10+) or
does the code need to change?

my ($page) = $page_number_txt =~ /PAGE (\d) >/;
 
T

Thomas Andersson

Tad said:
What happened when you tried it?

It's sorted now, basically my script processed pages and a had a function to
look for next page to see if it should continue. When page 10 came around it
bugged out as it found a page, but pagenumber was incorrectly set. Changing
to \d+ fixed it.
 
D

Dr.Ruud

Thomas said:
Will this line update $page with a number if it's double digit (ie 10+) or
does the code need to change?

my ($page) = $page_number_txt =~ /PAGE (\d) >/;

Also, be aware that \d is not the same as [0-9].


There are over 200 digit code points, see the output of:

perl -CO -we '$| = 1;
my $i;
$SIG{__WARN__} = sub{ die "$i:$_[0]" };
eval{ chr() || 1 }
and chr() =~ /\d/
and printf qq{%3s: %c [%x]\n}, ++$i, ($_)x2
for 0 .. 0x1FFFD
' 2>&1 |less
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,436
Messages
2,571,696
Members
48,796
Latest member
Greg L.
Top