I am trying to replace all the occurrences of @ in a string '217Z2800343645@@@@@@@25.00' with space using JavaScript regex expression
var addendaSpace = '217Z2800343645@@@@@@@25.00'
addendaSpace = addendaSpace.replace(/@/g,' ');
I am getting an output like this '217Z2800343645 25.00'
Heres a snippet. Dk if it's what you're looking for..
var ad = '217Z2800343645@@@@@@@25.00' var ada = ad.replace(/@/g, " ") console.log(ada)
html ignores mutlible spaces either use <pre></pre>
tag to preserve spaces or use nonbreakablespaces (
)
https://jsfiddle.net/agfwo8hu/
<pre>hello test</pre>
<p>hello test</p>
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.