Using regex to match variables in a string

I would like to match, using regex with groups, in java these scenarios but I am not very good with regex and don't understand how to match repeating things like these:

Text: local var1, var2, var3 = 100

I want to match to get all the lua variable names so my matches would be 'var1' and 'var2' and 'var3'

Text: self.var1, self.var2 = 200

Same as above but using self instead of local- I'd like matches of 'var1' and 'var2'

And lastly

Text: var1, var2, var3 = 300

I imagine I may be able to use the...

Read More »

By: StackOverFlow - 7 days ago

Related Posts