I tried various combinations but unsuccesfull at figuring out correct regex pattern.
Basically I want to capture patterns like examples below:
- {{variable}}
- {{variable.function1{param1}}}
- {{variable.function1{param1}.function2{param2}}}
and so on..
I wanted to capture variable,function1,param1,function2,param2 from this
So far I have below regex which does not work completely
\{\{([^{}.]+)(\.([^{}]+)\{([^{}]+)\})*\}\}
If I try to apply above pattern on example 3, I get below groups
- Group#1 - variable
- Group#2 - .function2{param2}
- Group#3 - function2
- Group#4 - param2
I was expecting somthing as below,
- Group#1 - variable
- Group#2 - .function1{param1}
- Group#3 - function1
- Group#4 - param1
- Group#5 - .function2{param2}
- Group#6 - function2
- Group#7 - param2
PS: you can check without writing code at http://regexr.com/3e4st