regex - Replace text followed by @ using javascript -
i want create javascript function replace word followed @
example:
var sample = "hello @jon how you"; var result = myfunction(sample); // result should "hello xxxxxx how you"
here @ symbol need replaced.
@\s+
try this.replace xxx
.see demo.
https://regex101.com/r/sj9gm7/38
var re = /@\s+/gm; var str = 'hello @jon how you'; var subst = 'x'; var result = str.replace(re, subst);
Comments
Post a Comment