I think it looks good.
However, I think using the 'www isin $1-' is a bit verbose. You could 'https:' instead of 'www' in conjunction with 'http:' as not all urls start with 'http:'.
I also think it'd be a good idea to use $strip() as sometimes you get people who advertise things who stick control codes in parts of the string, $strip() would fix that.