Current location: Hot Scripts Forums » Programming Languages » PHP » validation code


validation code

Reply
  #1 (permalink)  
Old 05-26-05, 12:34 PM
FiRe FiRe is offline
Code Guru
 
Join Date: Oct 2004
Location: UK
Posts: 801
Thanks: 0
Thanked 0 Times in 0 Posts
validation code

I need some validation code (can use regex or preg) to test for string is in this exact format:

ABC-123-DEF-456

thats 3 CAPITAL letters, dash, 3 numbers, dash, 3 CAPITAL letters, dash, 3 numbers!

thanks
__________________
Alexa Share <-- Trade virtual shares in websites with this online game.

codR.us <-- Submit and vote for your favorite code snippets with codR.us.

XEWeb.net <-- The ultimate PHP resource network.

Last edited by FiRe; 05-26-05 at 12:37 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 05-26-05, 03:52 PM
NeverMind's Avatar
NeverMind NeverMind is offline
Community VIP
 
Join Date: Aug 2003
Location: K.S.A
Posts: 2,257
Thanks: 0
Thanked 2 Times in 1 Post
PHP Code:

if (preg_match('~[A-Z]{3}-[0-9]{3}-[A-Z]{3}-[0-9]{3}~''ABC-123-EVS-765'))

   echo 
'Passed'
__________________
PHPSimplicity
We don't need a reason to help people - Zidane [FF9]
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[For Sale x2] Commercial ready CMS code Styric General Advertisements 1 05-06-05 10:33 AM
Have a look at my JSP code which is not giving me the desired output j.gohel Everything Java 1 04-07-05 04:55 AM
Can anyone help me ? (problem using php variables in html db insert code) chronic_ PHP 2 06-13-04 12:19 PM
How to sale php code to customer without giving him code pradeep_soft PHP 4 03-12-04 01:10 PM
protecting code in PHP ckb PHP 12 01-02-04 09:53 AM


All times are GMT -5. The time now is 08:27 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.