regex - Replace all occurrences of the dot character with an underscore character in javascript -
regex - Replace all occurrences of the dot character with an underscore character in javascript -
in javascript, need replace occurrences of dot character (.) underscore character (_) if except lastly one.
this look replaces occurrences of dot character (.) including lastly 1 underscore character (_) i'm trying figure out how alter leaves lastly (.) character alone.
str.replace(/\./g, '_'); thanks !!
steve
the fun look aheads.
"12.34.56.78".replace(/\.(?=[^.]*\.)/g,"_") javascript regex pattern-matching
Comments
Post a Comment