ASP equivalent to PHP ereg_replace function

I’ve used so many time the php function ereg_replace that when I have to use ASP (‘cause sometimens you have…

Novembre 10, 2009

I’ve used so many time the php function ereg_replace that when I have to use ASP (‘cause sometimens you have to use that old terrible language) I have to use it also in ASP.
I’ve also read on PHP site that this function will soon became depracated. I’m sad about that.
But in Microsoft ASP language ereg_replace doesn’t exists, so, here it is ASP equivalent to PHP ereg_replace:

function ereg_replace(pattern,change,str)
	Dim ObjRegexp
	Set ObjRegexp = New RegExp
	ObjRegexp.Global = True
	ObjRegexp.IgnoreCase = True
	ObjRegexp.Pattern = pattern
	str = ObjRegexp.Replace(str,change)
	Set ObjRegexp = Nothing
	ereg_replace = str
end Function

Author

PHP expert. Wordpress plugin and theme developer. Father, Maker, Arduino and ESP8266 enthusiast.