Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Regex for JavaScript variable identifiers

Reply
Thread Tools

Regex for JavaScript variable identifiers

 
 
Mark Szlazak
Guest
Posts: n/a
 
      08-21-2003
I'm attempting to make a regex that will match variable identifier names
without matching keywords or object properties, and matching function
argument names is optional.

This attempt seems to work but there has been little QA.

rx =
/(?:^|[=,;])\s*([a-zA-Z_$][\w$]*)\s*(?=\=)|\bvar\s*([a-zA-Z_$][\w$]*)\s*
(?=[=,;\n])/g;

If anyone can spot potential problems and/or how to improve them, please
let me know. Thanks in advance.



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How make regex that means "contains regex#1 but NOT regex#2" ?? seberino@spawar.navy.mil Python 3 07-01-2008 03:06 PM
Binding identifiers to known or unknown identifiers latashag@live.com Java 1 04-22-2008 04:54 AM
Unique System Identifiers and Javascript nondisclosure007@gmail.com Javascript 4 03-24-2006 09:45 AM
Advantages of denying keywords as identifiers valentin tihomirov VHDL 8 12-28-2004 06:44 PM
Link checker that checks fragment identifiers? Spartanicus HTML 2 05-25-2004 09:54 PM



Advertisments