|
 |
asp_databases thread: matching chars in a string/field
Message #1 by imran.saleem@b... on Thu, 19 Dec 2002 18:03:44
|
|
Guys,
i am new to regExp's, i am trying this code but its returning a true
value even when my string/field does not have any alphabetical characters.
dim strInput, regEx, xfound
strInput = trim(objRS(xFieldArr(i)))
Set regEx = New RegExp
regEx.Pattern = [a-zA-Z]
regEx.Global = True
xfound = regEx.Test(strInput)
if xfound then
Response.Write "alphabetical chars in field"
else
Response.Write "non alphabetical chars in field"
end if
Thanks in advance for your help
Message #2 by Jack_Speranza <jsperanza@g...> on Thu, 19 Dec 2002 14:01:49 -0500
|
|
You need to put your regexp pattern in quotes, as below:
Set regEx = New RegExp
regEx.Pattern = "[a-zA-Z]"
^ ^
-----Original Message-----
From: imran.saleem@b... [mailto:imran.saleem@b...]
Sent: Thursday, December 19, 2002 1:04 PM
To: ASP Databases
Subject: [asp_databases] matching chars in a string/field
Guys,
i am new to regExp's, i am trying this code but its returning a true
value even when my string/field does not have any alphabetical characters.
dim strInput, regEx, xfound
strInput = trim(objRS(xFieldArr(i)))
Set regEx = New RegExp
regEx.Pattern = [a-zA-Z]
regEx.Global = True
xfound = regEx.Test(strInput)
if xfound then
Response.Write "alphabetical chars in field"
else
Response.Write "non alphabetical chars in field"
end if
Thanks in advance for your help
Message #3 by imran.saleem@b... on Fri, 20 Dec 2002 10:32:46
|
|
Thanks Jack.
>
You need to put your regexp pattern in quotes, as below:
Set regEx = New RegExp
regEx.Pattern = "[a-zA-Z]"
^ ^
|
|
 |