I have the following parsing scenario in python, there is cases of lines:
{{ name xxxxxxCONTENTxxxxx /}}
{{ name }} xxxxxxxCONTENTxxxxxxx {{ name /}}
{{ name xxxxxxCONTENTxxx {comand} xxxxCONTENTxxx /}}
All I need to do is classify to which case the given line belongs using regex.
I can successfully classify between 1) and 2) but having trouble to deal with 3).
to catch 1) I use:
re.match('\s*{{[^{]*?/}}\s*',line)
to catch 2) I use:
re.match('{{.*?}}',line)
and then raise a flag to keep the context since case 2) can be over multiple lines. How can I catch case 3) ??
The condition which I'm currently trying to match is to test for:
- start with '{{'
- end with '/}}'
- with no '{{' in between
However I'm having a hard time phrasing this in regex.