Capturing Variable Names Alone
Now let's write the regular expression for the problem discussed in the previous lesson and verify it using JS code.
We'll cover the following...
Looking at our code, we can easily find the pattern. Variable names have one of the following characters next to them: a blank space, a dot, a closing parenthesis, or a semicolon. This is true for our example code, but we could make this a bit more generic by extending that definition if we had to.
Regular expression
By adding that condition, we can use a conditional match, also known as a positive lookahead (if you don’t remember what that is, go back to ...