473,394 Members | 1,706 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Problem with multiple matches

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
Nov 16 '05 #1
1 982
"Gigi Joseph K" <jo********@hotmail.com> wrote in
news:f4**************************@posting.google.c om...
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
Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: jagg | last post by:
Hi, with the code below the output is sort by $verantw but $title and $file in the same row DON'T belong to $verantw. How do I have to make the sort command that $verantw, $title and $file in...
12
by: Richard Hanson | last post by:
Over the last few days, I reinstalled Win2kSP2 to a spare harddrive I had just swapped into my Fujitsu LifeBook P1120 (long story <wink>). Subsequently, I DL'ed the newest Python alpha (2.4a2), and...
3
by: Andy_Khosravi | last post by:
I have been trying to build a user friendly search engine for a small database I have created. I'm having some particular problems with one of my date fields. Here's the setup: I'm using...
4
by: Ben Dewey | last post by:
Hey, I have only been playing with regular expressions for some time. I am working on some code that parses and object 560 event log. I have created two expressions the first one which works...
1
by: DKode | last post by:
I have the following regex that I am using: Match match = Regex.Match(global, "%(?<column>.+?)%"); my input string (global) is this: "something\%username%\somethingelse\%match2%\some\%match3%...
1
by: Petr Prikryl | last post by:
I did observe the problem when using the -U option on Windows 2000. Seems like some infinite recursion in cp1250.py -- see below. I did not try it with earlier versions of Python. Can this...
9
by: HC | last post by:
Hello, all, I started out thinking my problems were elsewhere but as I have worked through this I have isolated my problem, currently, as a difference between MSDE and SQL Express 2005 (I'll just...
1
by: connor7777 | last post by:
Hi guys: We've been weeding out errors off of a java->c# project and have managed to redeem most of our code with the exception of one bug that we for some reason cannot pin down. The following...
2
by: jiang.haiyun | last post by:
Hi, I am having some serious problems with PyQT4, when i run pyqt script, I always get 'Segmentation fault'. the script is simple: ====================== %less qttest.py from PyQt4 import...
5
by: mikko.n | last post by:
I have recently been experimenting with GNU C library regular expression functions and noticed a problem with pattern matching. It seems to recognize only the first match but ignoring the rest of...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.