Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hello,

 

I have a great regex for extracting hrefs from a web page, but I can not figure out where I can insert one of my submatch conditions.

 

Here is the regex that matches the href link.

 

(?:[hH][rR][eE][fF]\s*=)(?:[\s""']*)(?!#|[Mm]ailto|[lL]ocation.|[jJ]avascript|.*css|.*this\.)(.*?)(?:[\s>""'])

 

and here is another regex that matches part of the link:

 

W0QQitemZ([0-9]{5,10})QQ

 

Where in the first regex do I enter this one in order to get the following submatch?

 

Text: <html><a href=""http://cgi.ebay.com/YAMAZAKI-Gold-Accent-CARA-Soup-Spoon-Spoons-NEW_W0QQitemZ4358700777QQcategoryZ38242QQrdZ1QQcmdZViewItem""></html>

 

 

Match: http://cgi.ebay.com/YAMAZAKI-Gold-Accent-CARA-Soup-Spoon-Spoons-NEW_W0QQitemZ4358700777QQcategoryZ38242QQrdZ1QQcmdZViewItem

 

SubMatch: 4358700777

 

 

 

Thanks in advance,

 

Chuck

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...