Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript_howto thread: Help in Regular Expressions...


Message #1 by "Shankar" <bgs@s...> on Sun, 5 May 2002 13:08:33 +0530
Hi All,

   I am just trying to validate a company name using
JavaScript regular expression.

1. It can start with [a-zA-Z0-9]   - a-z A-Z 0-9

2. It can end with [a-zA-Z0-9\.\)] - a-z A-Z 0-9 . )

3. Valid special characters are

   . ( ) / , & - space

4. No two special characters should come adjacent
   except ). and .,
===============================
1. To check the starting I wrote,

         var strPat = /^([a-zA-Z0-9]+)/;

2. To check the ending I wrote,

         var strPat = /([a-zA-Z0-9][\.]?[\)]?)$/;

3. Valid characters can be checked by keypress event.

The problem is, I don't know how to implement point No. 4.

I appreciate your valuable suggestion / help. Thanks in advance.

Regards,
Shankar 

  Return to Index