Forum Moderators: coopster & phranque

Message Too Old, No Replies

Regex Problem

         

rfontaine

2:20 pm on Jul 12, 2005 (gmt 0)

10+ Year Member



How would I match the following, allowing that the number portion could actually be any positive number to infinity?

<a name=3><b>Page 3</b>

My regex ability is primitive to say the least - don't laugh, at least too much! I came up with this which, of course, does not work:

$by_page_array = preg_split("/^(\<a name\=)+([0-9])+(\>\<b\>Page)+( )+([0-9]\<\/b\>)/",$string);

andye

2:48 pm on Jul 12, 2005 (gmt 0)

10+ Year Member



Something like this?

$teststring =~ /^<a name=\d+><b>Page \d+</b>$/

(untested)

hth, a.

Update: whoops - forgot to escape the slash in the /b tag:

$teststring =~ /^<a name=\d+><b>Page \d+<\/b>$/