I'd like to extract variable names from this scratch of code:
var a,b,c, foo = "Test this is string";
I'd like the match result to contain a,b,c and foo and value optionally. I am able to split the string by a comma but I wonder if there's a way for this directly from the regex.
var\s+(.+)\s*,?\s*=.+;
You can test this out at http://rubular.com/
It shows me a,b,c,foo part but I'd like it to output in match groups like that:
- a
- b
- c
- foo