The SO link Javascript Regular expression to remove unwanted <br>, sp tells us to remove an expression using regex.But i want to remove &nb sp; without using regex.Angular expression:
{{notification.noti_val)}};Did:{{notification.noti_val.replace(/\&nb sp;/g, ' ')}}
.But doesnt delete the &nb sp;
Note:did a space between nb and sp cause SO was parsing it as whitespace so was showing it as whitespace
Use \\s*
instead of a literal space character. \\s
should match any kind of whitespace character. Adding *
next to \\s
should match any kind of space zero or more times.
noti_val.replace(/\&nb\s*sp;/g, ' ')
Note that this would replace
with a space character. If you want to remove then replace it with empty string.
noti_val.replace(/\&nb\s*sp;/g, '')
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.