Hello,
I'm using JavaScript to do some regular expression. Considering I'm working with well-formed source, and I want to remove any space before[,.] and keep only one space after [,.], except that [,.] is part of a number. Thus I use:
text = text.replace(/ *(,|\.) *([^ 0-9])/g, '$1 $2');
The problem is that this replaces also text in the html tag attributes. For example my text is (always wrapped with a tag):
<p>Test,and test . Again <img src="xyz.jpg"> ...</p>
Now it adds a space like this src="xyz. jpg"
that is not expected. How can I rewrite my regular expression? What I want is
<p>Test, and test. Again <img src="xyz.jpg"> ...</p>
Thanks!