vbscript multiple replace regex
Posted
by George
on Stack Overflow
See other posts from Stack Overflow
or by George
Published on 2010-05-21T18:40:34Z
Indexed on
2010/05/21
18:50 UTC
Read the original article
Hit count: 395
How do you match more than one pattern in vbscript?
Set regEx = New RegExp
regEx.Pattern = "[?&]cat=[\w-]+" & "[?&]subcat=[\w-]+" // tried this
regEx.Pattern = "([?&]cat=[\w-]+)([?&]subcat=[\w-]+)" // and this
param = regEx.Replace(param, "")
I want to replace any parameter called cat or subcat in a string called param with nothing.
For instance
string?cat=meow&subcat=purr or string?cat=meow&dog=bark&subcat=purr
I would want to remove cat=meow and subcat=purr from each string.
© Stack Overflow or respective owner