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(/&nbsp;/g, ' '); 

but can't 2 replacements using 1 regex


Comments

Popular posts from this blog

timeout - Handshake_timeout on RabbitMQ using python and pika from remote vm -

gcc - MinGW's ld cannot perform PE operations on non PE output file -

c# - Search and Add Comment with OpenXML for Word -