Hi I have the following code and I only want to pull out links that have www. in them
<p> Text < href="http://url.com/link/">link text</a> more text < href="http://www.anotehrurl.com/">more link text</a> and < href="http://www.anotherurl.com/sub/sub/link.html">link text</a>. more text < href="http://keepurl.co.uk/link/">link text</a> more text < href="http://www.anotherurl.com/sub/sub/link.html">link text</a>. < href="http://www.anotherurl.com/sub/sub/link.html">link text</a>. < href="http://www.anotehrurl.com/">more link text</a></p>
im using the reg expression:
(<a href="http:\/\/www.[\d\D]*?\/">([\d\D]*?)<\/a>)
basically I want to match any link that starts with www and not match any link that is keepurl.co.uk/…….
I have put this through rubular and come out with following:
{
Result 1
1.< href=”http://www.anotehrurl.com/”>more link text
2.more link text
Result 2
1.< href=”http://www.anotherurl.com/sub/sub/link.html”>link text. more text
< href=”http://keepurl.co.uk/link/”>link text
2.link text
Result 3
1.< href=”http://www.anotherurl.com/sub/sub/link.html”>link text. < href=”http://www.anotherurl.com/sub/sub/link.html”>link text. < href=”http://www.anotehrurl.com/”>more link text
2.more link text
}
as u can see its pulling out more than i want.
cheers
What about this:
OUTPUT: