...

View Full Version : Regular Expressions



Loic
10-05-2007, 03: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
Else
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?

nikkiH
10-05-2007, 03:34 PM
Try

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

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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum