I'm writing a syntax highlighter for the Sublime Text editor (that uses the Oniguruma regex definitions). Basically, I have something like this:
Regex:
\((\w+\s*)*\)
Test:
(how are you)
Capturing groups:
1. you
My problem is, that only the last occurrence in the capturing group is matched (and therefore highlighted) and not the entire content of the capturing group.
In my concrete case:
Regex:
\(\w+(\s+(\?\w+\s+)+-\s+(\w+))*\)
Test:
(at ?l - location ?x - object)
Capturing groups:
1. ?x - object
2. ?x
3. object
However, I'd like to match the entire group content, like that:
1. ?x - object AND ?l - location
2. ?x AND ?l
3. object AND location