C
CodeSponge
Hey guys,
I'm working with a regular expression to replace patterns in a given
string. however I want to replace the patterns with another pattern
using submatch references.
ie:
if my search pattern was
"(\s)ks ?#?(\d*)(\s)"
and my replacement pattern was
"\1KS \2\3"
I would expect " ks#12 " or " kS12 " to convert to " KS 12 "
The regEx object has a replace method but it does the replacement as a
literal string copy of the replacement pattern instead of using the
submatches.
This is easy to do with most other regEx implimentations I can think
of.
any Ideas?
thanks in advance
Shaun
I'm working with a regular expression to replace patterns in a given
string. however I want to replace the patterns with another pattern
using submatch references.
ie:
if my search pattern was
"(\s)ks ?#?(\d*)(\s)"
and my replacement pattern was
"\1KS \2\3"
I would expect " ks#12 " or " kS12 " to convert to " KS 12 "
The regEx object has a replace method but it does the replacement as a
literal string copy of the replacement pattern instead of using the
submatches.
This is easy to do with most other regEx implimentations I can think
of.
any Ideas?
thanks in advance
Shaun