[thelist] ASP - Regular Expressions

burgan at iprimus.com.au burgan at iprimus.com.au
Tue Aug 5 09:13:37 CDT 2003


----- REPLY -----
"[\-{2}]" should match --
Will that do for you?
----- /REPLY -----

Nah nothing's working.

By the way i'm trying to make entries like "--text" and "text--" return
false.. but i'm also trying to make "-text" and "text-" return FALSE.

Code like "t-ext" or "te-xt" etc is what I want to return TRUE.

I've tried the following:
objRegExpr.Pattern = "^[a-zA-Z]*[\-]*[a-zA-Z]$"
objRegExpr.Pattern = "[^a-zA-Z]*[\-]*[a-zA-Z]$"
objRegExpr.Pattern = "[^a-zA-Z]*[\-]*[a-zA-Z$]"
objRegExpr.Pattern = "^[a-zA-Z]*[\-]*[a-zA-Z$]"
objRegExpr.Pattern = "^[a-zA-Z]*[\-]*[a-zA-Z$][\-{1,2}]"
objRegExpr.Pattern = "^[a-zA-Z]*[\-]*[a-zA-Z$][\-{1,2}]$"
objRegExpr.Pattern = "^[a-zA-Z]*[\-]*[a-zA-Z$][\-{1,2}$]"
objRegExpr.Pattern = "^[a-zA-Z]*[\-]*[a-zA-Z$]*[\-{1,2}]"
objRegExpr.Pattern = "^[a-zA-Z]*[\-]*[a-zA-Z$]*[\-{1,2}]$"
objRegExpr.Pattern = "^[a-zA-Z]*[\-]*[a-zA-Z$]*[\-{1,2}$]"

Sorry about the long email full of code, but the context of the above
line's is as follows:

Function IsValidChar(strData)
Dim objRegExpr
Set objRegExpr = New RegExp
objRegExpr.Pattern = "^[a-zA-Z]*[\-]*[a-zA-Z]$"
objRegExpr.Global = True
objRegExpr.IgnoreCase = True
strData = objRegExpr.Replace(strData, "")
IsValidChar = objRegExpr.Test(strData)
Set objRegExpr = Nothing
End Function

I'm open to any more suggestions that anyone has.
Thanks again for taking the time to help.
Cheers
Tim

--------------------------------------------------------------------
mail2web - Check your email from the web at
http://mail2web.com/



More information about the thelist mailing list