javascript - Modifying an existing RegEx to accommodate also replacing <nbsp;>'s with a blank space -
i need help,
how can existing code below modified such not takes account replacing <br>
's \n'
s <nbsp;>
's anywhere in string space separator in javascript?
here existing code needs modified:
var txt = str.replace(/<br\s*\/?>/mg,"\n")
you may use this
var txt = str.replace(/<br ?/?>/g, '\n').replace(/ /g, ' ');
but can't 2 replacements using 1 regex
Comments
Post a Comment