I'm trying to create a regexp that can match this:
argument ::= define_scope [';' define_scope]*
define_scope ::= (['local'] | 'global') define_var
define_var ::= variable_name expression
variable_name ::= Name
So, something like local varName something;;world foo bar;;local foobar bar.
I've tried with:
((^|;;)?(local|world) (.+?) (.+?))+
but if I use this on the previous example I obtain these matches:
local varName s
;;world foo b
;;local foobar b
so it take only the first letter of the last word of each match.
If I remove the lazy matching from the last group, it match only:
local varName something;;world foo bar;;local foobar bar
so the last group is something;;world foo bar;;local foobar bar.
Some ideas to fix this?