Posted By

ginoplusio on 11/11/08


Tagged

regex regular ASP Expression eregreplace


Versions (?)

Asp ereg_replace function (similar to php function)


 / Published in: ASP
 

URL: http://www.barattalo.it

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

  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

Report this snippet  

You need to login to post a comment.