You are here: Help with regular expression... « HTML « IT news, forums, messages
Help with regular expression...

Posted by Noozer on 06/28/05 13:59

Not sure which newgroup would be best... but since this is being used in a
Javascript function on a web page I guess it could go here...

I'm looking for some help with a regular expression. Users can enter an
account number with or without hyphens. Format for an account number is
000-0000-0000.

Is there a regular expression I can use to ensure that the hyphens are
always there?
User input ->Result
12312341234 -> 123-1234-1234
123-12341234 -> 123-1234-1234

How about to always remove hyphens.
User input -> Result
123-1234-1234 -> 12312341234
1231234-1234 -> 12312341234

Finally, any regular expression to ensure that only 11 characters have been
entered and only digits have been entered. What changes would be need to
accept digits AND hyphens.
User input -> Result
123-1234-1234 = False
12312341234 = True
1231234ABCD = false
1231234123 = false
...with changes...
123-1234-1234 = True

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация