I have a question that is relatively simple but brought me to the wall. I want to have a regex do following task in VBA (VBScript_RegExp_5.5).
Given a string like this:
"PrivateFactoryAsclsFactoryPrivateFactoryAsclsFactory"
I want to remove only the occurrences of "Factory"
that are not preceded by "cls"
. For this particular case, if all matches are correctly replaced with "_"
, the result will look like this:
"Private_AsclsFactoryPrivate_AsclsFactory"
Of course, a simple exclusion trick like "clsFactory|(Factory)"
does not works in VBA, nor do look-behinds.