How to match this

Any questions involving matching text strings to patterns - the pattern is called a "regular expression."

Moderator: General Moderators

Post Reply
GeXus
Forum Regular
Posts: 631
Joined: Sat Mar 11, 2006 8:59 am

How to match this

Post by GeXus »

Ok, I just don't get regex... im lost.. this is what I want to match
<h2 class=a><a href="http://urlhere" class=b><b>Site Name</b> - Site Title</a></h2>
I'm trying to extract two thigns from this.. 1. the URL and 2. the site name - title (the <b> should be ingore or returned with that match..

This is what I have for the URL

Code: Select all

/<h2 class=a><a href="(.*?)" class=b>/
Needless to say, It doesnt work, it still returns matches even for URLs that do not have the ending class=b,.. Any help would be GREAT!
User avatar
Ollie Saunders
DevNet Master
Posts: 3179
Joined: Tue May 24, 2005 6:01 pm
Location: UK

Post by Ollie Saunders »

I don't see how it would do that. Post the input and the output please.
GeXus
Forum Regular
Posts: 631
Joined: Sat Mar 11, 2006 8:59 am

Post by GeXus »

I actually think I had something else that was causing the issue.... sorry, thanks anyways though
Post Reply