Hi,
I'd like to globally replace a substring specified by a regular
expression with itself along with some additional characters.
example:
var oldString = 'asdf BRACKETTHISasdf sdf sd asdBRACKETTHISa sdf asd';
var newString =
oldString.repla ce(/\s\w*BRACKETTHI S\w*/g, '<' + ?some expression that
accesses current match? + '>' )
And newString winds up as:
'asdf <BRACKETTHISasd fsdf> sd <asdBRACKETTHIS asdf>
asd'
Is there a way to do this, or do I have to use other methods?
Thanks for helps,
Kurt
I'd like to globally replace a substring specified by a regular
expression with itself along with some additional characters.
example:
var oldString = 'asdf BRACKETTHISasdf sdf sd asdBRACKETTHISa sdf asd';
var newString =
oldString.repla ce(/\s\w*BRACKETTHI S\w*/g, '<' + ?some expression that
accesses current match? + '>' )
And newString winds up as:
'asdf <BRACKETTHISasd fsdf> sd <asdBRACKETTHIS asdf>
asd'
Is there a way to do this, or do I have to use other methods?
Thanks for helps,
Kurt
Comment