Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 06-29-2002, 06:50 PM   PM User | #1
avelonx
New Coder

 
Join Date: Jun 2002
Location: United States
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
avelonx is an unknown quantity at this point
Validating whether string contains llegal chars

Could someone please give me a code that will check if a string contains only numerical and alphabetical characacters in it..
ya know..

abcedfghijklmnopqrstuvwxyz
1234567890

Last edited by avelonx; 06-30-2002 at 01:19 PM..
avelonx is offline   Reply With Quote
Old 07-01-2002, 04:51 AM   PM User | #2
Astro-Boy
New Coder

 
Join Date: Jun 2002
Location: Sydney, NSW, Australia
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Astro-Boy is an unknown quantity at this point
PHP Code:
$str 'lkdsaglfkgslfkjagsd';
if (
preg_match('/[^\\dA-Za-z]/'$str)) {
  die(
'illegal characters!');

- Mark
__________________
[ AstroBoy Online | Experiments in Stuff | Google, use it! ]
Astro-Boy is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:22 AM.


Advertisement
Log in to turn off these ads.