tags:

views:

37

answers:

2

I'm trying to write a regex to automatically find urls, so that I can turn them into marked up a hrefs. The issue I'm having is dealing with urls that have already been marked up (The documents contain a mix of marked up and not marked up urls). So basically my problem comes down to this:

I want to match any URL that isn't already enclosed in an href. i.e I want to ignore the following.

Thanks for any help.

A: 

Use negative look ahead to see if an url does NOT have </a> ahead of it:

your_regex(?!\s*</a>)
Bart Kiers