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.
Generally,
ORin regex is a pipe:In this case, this will also work: making
suboptional:Another option is to use or on the not-shared parts: