Jump to content

Archived

This topic is now archived and is closed to further replies.

shan_cool

Init Character Checking

Recommended Posts

Hi all,
I hav a text field in which the data must be provided in A233784545 format. i mean the intial starting letter must b a character and all other letters can either be numeric or characters.... help me how to validate this.... am using PHP .

Rhds,
Shan...
Chennai,
India.

Share this post


Link to post
Share on other sites
[!--quoteo(post=345601:date=Feb 14 2006, 09:43 AM:name=shan_cool)--][div class=\'quotetop\']QUOTE(shan_cool @ Feb 14 2006, 09:43 AM) [snapback]345601[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Hi all,
I hav a text field in which the data must be provided in A233784545 format. i mean the intial starting letter must b a character and all other letters can either be numeric or characters.... help me how to validate this.... am using PHP .

Rhds,
Shan...
Chennai,
India.
[/quote]

[a href=\"http://www.google.no/search?hl=no&q=php+validation\" target=\"_blank\"]http://www.google.no/search?hl=no&q=php+validation[/a]
[a href=\"http://www.google.no/search?hl=no&q=javascript+validation\" target=\"_blank\"]http://www.google.no/search?hl=no&q=javascript+validation[/a]

PHP
if(preg_match("/^[a-Z]\w+/",$text_field)) { }

will match a string starting with a word character and continues with 1 or more word characters

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.