I’m not sure how to do this.
Anyway to detect a url as content, and, then concat a tag around it?
I want this to be done in Javascript. Outputted in HTML.
Let’s say I have a string with regular text, as well as a url in it.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Something like this:
would do the job once you’ve identified your links. To do that you have to restrict the format of links, for example by requiring that they include the
http://(orhttps://etc.). If you’re only looking for well-formed links, you can search for strings beginning withhttp://etc. and ending before the first non-URL character:using regexp character classes: