Starting string:
I like [dogs], [cats], and [birds]
Final output needed:
I like <a href="#">dogs</a>, <a href="#">cats</a>, and <a href="#">birds</a>
So basically changing items with brackets to links.
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.
Use this expression:
\[(.+?)\]asks for a literal[, to lazily match and capture anything, then to match a literal]. Replace with the captured stuff enclosed in<a>tags.The
gmodifier means global replacement, i.e. find and replace every match and not just the first.jsFiddle preview