Problem with multiple matches

  • Thread starter Thread starter Gigi Joseph K
  • Start date Start date
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
 
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
 
Back
Top