asp.net - Replace in-string characters with regex in javascript -


i'm pretty unconfident regex , need simple work: have input string this:

<a id="randomid">some text ( +1 more text)</a> 

now need replace "1", know between ( + , space, how can regex?

that string generated asp.net inside asp:hyperlink component, first try generate number inside <span> know id, looks asp.net remove html tags inside asp component

assuming you're using jquery...

$('a#randomid').text().replace(/(.+ \( \+)([0-9]+)(.+)/, "$12$3") 

will give you...

some text ( +2 more text) 

Comments