javascript - jHow to replace string from a part of given string? -
var ans = '#1>2,2,2,0,#2>3,2,1'
i want remove 2 immediate after #1> not #2>. expected result is:
ans = '#1>0,#2>3,2,1'
how can using jquery?
try one
var ans = '#1>2,2,2,0,#2>3,2,1' ans.replace(/#1>(2,{0,})+/g,function() { return "#1>" })
output:
#1>0,#2>3,2,1
Comments
Post a Comment