CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> ASP

 Regular Expression

Print topic Send  topic

Author Message
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
View profile  Send private message
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
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.