Asp ereg_replace function (similar to php function)


/ Published in: ASP
Save to your folder(s)

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...


Copy this code and paste it in your HTML
  1. function ereg_replace(pattern,change,str)
  2. Dim ObjRegexp
  3. Set ObjRegexp = New RegExp
  4. ObjRegexp.Global = True
  5. ObjRegexp.IgnoreCase = True
  6. ObjRegexp.Pattern = pattern
  7. str = ObjRegexp.Replace(str,change)
  8. Set ObjRegexp = Nothing
  9. ereg_replace = str
  10. end Function

URL: http://www.barattalo.it

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.