Tuong Do
|
| Posted: 10/27/2005, 11:59 PM |
|
Do any one know how to construct a regular expression string to only accept
the string value a-z and A-Z and blank space only
eg
John Smith
David Jones
but not
John& Smith
Or not
John9 Smith
|
|
|
 |
mrachow
Posts: 509
|
| Posted: 10/28/2005, 5:25 AM |
|
<%
Dim strOriginalString : strOriginalString = "A Name"
' strOriginalString = "1No Name"
' strOriginalString = "Not a Name"
Dim nextLine : nextLine = "<BR>"
response.write(StrOriginalString)
response.write(nextLine)
dim objRegExp : set objRegExp = new RegExp
with objRegExp
.Pattern = "^[a-z]+ [a-z]+$"
.IgnoreCase = true
.Global = true
end with
ok = objRegExp.test(strOriginalString)
set objRegExp = nothing
response.write(ok)
%>
_________________
Best regards,
Michael |
 |
 |
Tuong Do
|
| Posted: 11/01/2005, 2:21 PM |
|
Thank mrachow,
It works,
How do I extend this to
David John Smith
Or
David John Test Smith
Or
Mr David John Test Smith
that is more than 2 names
"Tuong Do" <tuongdo@hotmail.com> wrote in message
news:djsi9f$agt$1@news.codecharge.com...
> Do any one know how to construct a regular expression string to only
> accept the string value a-z and A-Z and blank space only
>
> eg
> John Smith
> David Jones
>
> but not
>
> John& Smith
>
> Or not
>
> John9 Smith
>
|
|
|
 |
blankenb
Posts: 125
|
| Posted: 11/01/2005, 4:37 PM |
|
check out www.regexbuddy.com
|
 |
 |
|