[thelist] regex help

Brian Cummiskey Brian at hondaswap.com
Fri Nov 16 13:30:37 CST 2007

Hi guys,

I'm looking for a regex for some textareas.  Basically, anything goes, 
so I can't strip out everything.
On the contrary, I'm ALLOWING things instead.

Here's what i've come up with so far:

Function cleanup(str)
    str =Trim(str)
    Dim regEx
    Set regEx = New RegExp

    ' find ALL matching substrings, instead of just the first instance.
    regEx.Global = true
    regEx.Pattern = "[^0-9a-zA-Z\s-.]"

    'replace the junk with ''
    output = regEx.Replace(str, "")

    cleanup = output

End function

This gets me everything i need except single quotes and double quotes, 
but they need to be escaped.

any suggestions?

More information about the thelist mailing list