Hi, everybody.

I'm an newbie in Java regular expressions world and I'm need help.
The task is to wrap in <a> tag all urls (substrings which started with "http:\" or "https:\\"). Those urls which has already been wrapped in tag should not be changed.

For example, string "<a title=\"fff\" href=\"http:\\www.a1.com\"> <p> http:\\Always-on Marketing: Direct Marketing Consultant, David Berger, Ann Arbor, Michigan </p> <p>http:\\www.a3.com</p>" should be changed to "<a title=\"fff\" href=\"http:\\www.a1.com\"> <p> <a href=\"http:\\www.a2.com"\>http:\\www.a2.com</a> </p> <p><a href="http:\\www.a3.com">http:\\www.a3.com</a></p>"

This code works fine:

return src.replaceAll("(\\A|\\s)((http|https|ftp|mailto): \\S+)(\\s|\\z)", "$1<a href=\"$2\">$2</a>$4");

It changes "http:\\www.a2.com" to "<a href=\"http:\\www.a2.com"\>http:\\www.a2.com</a>"
but has no effect on "<p>http:\\www.a3.com</p>", it doesn't change the src string.

Please help me. How can i modify these regular expressions to solve my problem ?

Every help will be appreciate. Thanks.