[advanced search]
Results from the most recent live auction are here.
21 members in the live chat room. Join Chat!
Register Rules & FAQ NP$ Store Active Threads Mark Forums Read
Domain Name Industry Newsletter
Go Back   NamePros.Com > Design and Development > Programming
User Name
Password

Old 06-04-2006, 05:12 PM   · #1
unknowngiver
Senior Member
 
Name: Zubair
Location: Ontario Canada
Trader Rating: (53)
Join Date: May 2005
Posts: 2,754
NP$: 724.15 (Donate)
unknowngiver is a name known to allunknowngiver is a name known to allunknowngiver is a name known to allunknowngiver is a name known to allunknowngiver is a name known to allunknowngiver is a name known to all
checking for certain chars?

Hey
Can anyone help me do this:

I am trying to check for specific characters in a string..and if they are there...i want it to give an error...i want to check the string "$username" and check for everything that is not a alphanumberical char...

so if it contains ";" or "," or ":" or "}" etc..i want it to give an error
can anyone help me out...


Please register or log-in into NamePros to hide ads
unknowngiver is offline   Reply With Quote
Old 06-04-2006, 05:24 PM   · #2
SecondVersion
while ($awake){ code(); }
 
SecondVersion's Avatar
 
Name: Eric
Location: Kentucky
Trader Rating: (142)
Join Date: Mar 2005
Posts: 4,268
NP$: 1152.00 (Donate)
SecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond repute
Member of the Month
MOTM September 2005 Save a Life Child Abuse 9/11/01 :: Never Forget Baby Health Marrow Donor Program AIDS/HIV Breast Cancer Cystic Fibrosis Ethan Allen Fund Animal Cruelty Ethan Allen Fund Ethan Allen Fund Cancer Alzheimer's Protect Our Planet
PHP Code:
<?php

if (preg_match("/([^a-z0-9]+)/i", $string))
{
    die(
'Error: string can only contain letters (a-z) and numbers (0-9)');
}

?>
__________________

SecondVersion.com - The Personal Blog of SecondVersion
Domain Name Portfolio - Get your free copy. - Version 1.0.3 now available!!
SecondVersion is offline   Reply With Quote
Old 06-04-2006, 05:50 PM   · #3
ninedogger
DNOA Member
 
ninedogger's Avatar
 
Location: Iowa
Trader Rating: (38)
Join Date: Jun 2004
Posts: 655
NP$: 13.10 (Donate)
ninedogger is a glorious beacon of lightninedogger is a glorious beacon of lightninedogger is a glorious beacon of lightninedogger is a glorious beacon of lightninedogger is a glorious beacon of lightninedogger is a glorious beacon of light
Save The Children
Originally Posted by SecondVersion
PHP Code:
<?php

if (preg_match("/([^a-z0-9]+)/i", $string))
{
    die(
'Error: string can only contain letters (a-z) and numbers (0-9)');
}

?>



don't you need the ! in !preg_match?
__________________
Want to prove yourself?

CHECK OUT MY DOMAINS!
ninedogger is offline  
  Reply With Quote
Old 06-04-2006, 06:01 PM   · #4
Dan
Buy my domains.
 
Dan's Avatar
 
Name: Dan
Trader Rating: (63)
Join Date: Feb 2006
Posts: 2,801
NP$: 54.00 (Donate)
Dan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant future
Autism Autism Autism Autism Autism Autism Autism
No, he did ([^... the ^ means not those characters.
Dan is offline   Reply With Quote
Closed Thread

NamePros is a revenue sharing forum.

Thread Tools

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


Site Sponsors
Hunting Moon Hunting Moon Website Header Design
Advertise your business at NamePros
All times are GMT -7. The time now is 10:28 AM.


Powered by: vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0