Return to Snippet

Revision: 9529
at November 11, 2008 05:49 by ginoplusio


Updated Code
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

Revision: 9528
at November 11, 2008 05:47 by ginoplusio


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

Initial URL
http://www.barattalo.it

Initial Description
similar to php ereg_replace.
You can pass this pattern [^A-Za-z0-9] and "" to remove from string non alphanumerical chars:

s = ereg_replace("[^A-Za-z0-9]","",s)

I use this function to clean input fields...

Initial Title
Asp ereg_replace function  (similar to php function)

Initial Tags
regex, ASP

Initial Language
ASP