How do I change this
var html = '<div>doe, john (Likes pizza)</div>'
To this:
var result = '<div>doe, john <span class="myspan">(Likes pizza)</span></div>'
to find the parens (...) and wrap it with a <span>
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.
In the console of Chromium:
Edit – so that it finds any text inside parens, and not just “Likes pizza”.
Edit2 – as described in the comments, it can be broken, e.g. with
s = "<div class="Eric (likes breaking things)"> >>doe, john ((Likes) nested regex)</div>";