Problem with multiple matches

G

Gigi Joseph K

I have the following expression
\<A\s*HREF\="[\w|_|\-|\/]*\?[\d|,]*">(?<LinkNum>\d*)\<\/A\>

This pattern works perfectly when I apply the pattern against the
single string such as

"somebody tried to do this <A
HREF="/cgi-bin/show_case_doc?9,3834,,,">92</A> on or before 8/11/03"

I get 92 in the LinkNum in the named group successfully. But if I
apply the pattern to a HTML document which contains sentences similar
to the string given above, then the named groups will capture only the
firt digit in each of this match.(For Eg, in the above string, named
group will capture only 9 instead of 92).I am constantly running into
this issue with other expressions as well both in global replacement
and matching. Could anyone point to me what am I doing wrong and why
it is behaving like this.
Thanks
_GJK
 
N

Niki Estner

Gigi Joseph K said:
I have the following expression
\<A\s*HREF\="[\w|_|\-|\/]*\?[\d|,]*">(?<LinkNum>\d*)\<\/A\>

You don't need to escape '<', '>', '=', '/'. Also, you don't need a '|'
character inside a set. However, I don't think this could cause the problems
you describe. Could you post a longer sample where the regex fails?

Niki
 

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

Top