javascript - Match parts of code -
i'm trying match parts of code regex. how can match var, a, =, 2 , ; from
"var = 2;"
?
i believe want regexp: /\s+/g
to break down: \s
selects non-whitespace characters, +
makes sure selects multiple non whitespace characters (i.e. 'var'), , 'g' flag makes sure selects all of occurrences in string, , instead of stopping @ first 1 default behavior.
this helpful link playing around until find right regexp: https://regex101.com/#javascript
Comments
Post a Comment