I need to match something like this:
int a= 4, b, c = "hi";
I already made a regex that successfully strips everything away from the line, leaving only
a= 4, b, c = "hi"
I don't care about the types of the variables, like "hi" being a String, because that will be checked later in the code.
Basically, I need to match a variable declaration with everything stripped off except the variables themselves, with or without the = part.
These are examples that should not match:
a b= 4
var,
,hello=3
=8
I have checked this question out, it didn't really help.
I have tried this code, but there are a couple of problems, namely pretty much everything that I have listed in the things that shouldn't match, do match.
Also there might be more things that I missed.
I am supposed to match strings with spaces, for example a = "hello there", and there isn't a requirement to match a string with , inside it.
"Formal" defenition of what a variable name can be:
Variable name can be any sequence (length > 0) of letters (uppercase or lowercase), digits and the underscore character. Name may not start with a digit. Name may start with an underscore, but in such a case it must contain at least one more character
Thanks for the help!
