Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RegExp in Javascript - Negating chars

Status
Not open for further replies.

BomberMan2K

Programmer
Sep 19, 2007
36
IL
Hi,
I want to validate a field for SPSS - i.e I want it to be only alphanumeric include under-scope, but it can't start with a number or an under-scope (and can't end with it).
I use the following regex: /^[a-zA-Z0-9_]+$/
But it only validates for alphanumerics. no negation like i want.

Please help - Want changes are needed to negate the start and end with under-scope and start with number.

Thank you for any help,
Roman.
 
[tt]/^([a-zA-Z]{1,2}|[a-zA-Z][a-zA-Z0-9_]+[a-zA-Z])$/[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top