Click to See Complete Forum and Search --> : regular expression question


sanatpadhy
02-01-2005, 11:11 PM
Hi all,

Can any one tell me what this pattern means

"^\\d{5}(-\\d{4})?$"

Does this accepts 5numbers-4numbers?

Can anyone give me patter which accepts "1234-1234567891".

Waiting for prompt reply.

Thanks in advance.

Khalid Ali
02-02-2005, 06:13 PM
try the following it should work

/^[0-9]{3}(-)[0-9]{4}$/

it checks for first 3 chars to be numbers and lst four to be number

sanatpadhy
02-02-2005, 09:01 PM
Thanks

It's working.