Check if string is (a-Z 0-9 and -)

Any questions involving matching text strings to patterns - the pattern is called a "regular expression."

Moderator: General Moderators

Post Reply
psychotomus
Forum Contributor
Posts: 487
Joined: Fri Jul 11, 2003 1:59 am

Check if string is (a-Z 0-9 and -)

Post by psychotomus »

i only want strings that containt z-z A-Z 0-9 and -

how can i do this?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

What have you tried?
psychotomus
Forum Contributor
Posts: 487
Joined: Fri Jul 11, 2003 1:59 am

Post by psychotomus »

right now im using php. just looping threw characters and checking them
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Post by Christopher »

Do you want to check if it contains only those characters or filter out any characters but those you want?
(#10850)
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

psychotomus wrote:right now im using php. just looping threw characters and checking them
I assumed that. What I am wanting to see is what have you tried to do so using a regular expression?
psychotomus
Forum Contributor
Posts: 487
Joined: Fri Jul 11, 2003 1:59 am

Post by psychotomus »

I don't even know where to begin =(
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

psychotomus wrote:I don't even know where to begin =(
Have you read the stickies in this section? How about other threads? The regular expression threads linked from Useful Posts?
Post Reply