I would like to do a replace with two characters.
Below is my code, my problem is now i need to replace ‘/’ as well rather than just ‘-‘, run replace twice is not really a good idea, and i am pretty bad at regular expression. Is anyone can help me write a RegExp which will search the whole string and replace any ‘-‘ o r’/’ have.
var myPattern:RegExp = / /gi;
productId.replace(myPattern, '-')
Match any character within
[]of your RegEx.To replace both “/” and ” ” (space):
Example:
Would produce: