View Full Version : Regular Expressions

10-05-2007, 02:56 AM
Hi all, I am trying to make a regular expression to only math alphabetic characters in vb script. i am trying to use something similar to what i would use in javascript but i cant get it working.

StringToSearch = "asdasdddd3423d"

Set myRegExp = New RegExp
myRegExp.IgnoreCase = True
myRegExp.Global = True
myRegExp.Pattern = "[a-z]"

expressionmatch = myRegExp.Test(StringToSearch)

If expressionmatch Then
Response.Write myRegExp.Pattern & " was found in " & StringToSearch
Response.Write myRegExp.Pattern & " was not found in " & StringToSearch
End If

it half works, it dose match the alphabetic characters but i want it to return a false value if there are numbers in the search string... any ideas where i am going wrong?

10-05-2007, 02:34 PM

myRegExp.Pattern = "^[a-z]+$"

10-08-2007, 01:03 AM
Thanks, That worked :)