Login Register


REGEX FOR VALID JAVASCRIPT VARIABLE IN 1ST CHARACTER filter_list
Author
Message
REGEX FOR VALID JAVASCRIPT VARIABLE IN 1ST CHARACTER #1
Why am I so stupid? I need to test one character.
Regex has scared me for so long, I really don't know what I'm doing.
I'm writing a parser, so I'm only testing one character at a time.
the block of code I'm working with "knows" it's about to work on a variable. (or expects to)
For the first character in that variable I need to determine if it's $, _ or abc(a letter).
Code:
if( /\w_$/g.test( _.getCurr() ) )
This, does not work. It doesn't match for $
(This post was last modified: 04-06-2017, 03:46 PM by FractalBomb.)

Reply





Messages In This Thread
REGEX FOR VALID JAVASCRIPT VARIABLE IN 1ST CHARACTER - by FractalBomb - 04-06-2017, 03:44 PM



Users browsing this thread: 1 Guest(s)