[thelist] ASP - Regular Expressions

Chris Marsh chris at ecleanuk.com
Tue Aug 5 08:18:28 CDT 2003


> >     objRegExpr.Pattern = "^[a-zA-Z][\-]*[a-zA-Z$]"
> 
> (I don't know ASP but) I think you need a * or a + for the 
> letters too, 
> like:
> 
> ^[a-zA-Z]*[\-]*[a-zA-Z]*$
> 
> * if you want zero or more, replace with + if you want to 
> match one or 
> more characters.

objRegExpr.Pattern = "^[a-zA-Z]+[\-]*[a-zA-Z]+$"

This should return True for te-st and te--st.

objRegExpr.Pattern = "^[a-zA-Z]+[\-]?[a-zA-Z]+$"

This should return True for te-st and False for te--st.

HTH

Regards

Chris Marsh



More information about the thelist mailing list