Forum Moderators: coopster

Message Too Old, No Replies

Format string to be accepted

accept a string in formar viz.date 9999/99/99

         

vikaspa

12:10 pm on Apr 23, 2004 (gmt 0)

10+ Year Member



I want to accept thea a string in following format
9-numeric
x-alpganumeric

Format
999/xx/9999-99/****xx/9/x

I want to accept data in this format
some of exa,ples of data
123/ab/1023-11/lmnop/0/y

With regards
Vikas Athavale

MrCrowley

8:07 pm on Apr 23, 2004 (gmt 0)

10+ Year Member



I'm not an expert at regexp, but this seems to work

$reg = '#[0-9]{3}/[a-zA-Z]{2}/[0-9]{4}-[0-9]{2}/[a-zA-Z0-9]*[a-zA-Z]{2}/[0-9]{1}/[a-zA-Z]{1}#';

$match = preg_match($reg, '999/xx/9999-99/h98bxg/9/s');

Maybe someone could simplify it or make it more efficient?