1

Possible Duplicate:
Replace URLs in text with HTML links

I am curious to know if this is possible. In my web app, I have a 'notes' section (basically a single <textarea>. and when the user is inputting information I would like it if there could be a 'search' function to find if the user input a URL into the 'note'.

IE->Enter Note = "This was a great meeting, the client mentioned to look at http://www.example.com "

So take that Note and find the URLS and make them CLICKABLE after they submit the note to the DB.

I am not sure if using jQuery would best the best solution or if I should use a server side script or something of that nature.

Your help is always appreciated!! Cheers.

Community
  • 1
  • 1
Justin
  • 2,502
  • 7
  • 42
  • 77

1 Answers1

1

via a simple regex in js:

note = note.replace(/(https?\S*)/g, '<a href="$1">$1</a>');