Extract all the matched values in a given string to an array- AJO
Hi All,
Need help regarding for requirement- "Extract all the matched values within double curly braces and add all of those matched items to an array."
{% let InputString= "This is an input String-{{match1}} and need to extract all values inside double curly braces {{match2}}, {{match3}}" %}
{% let Output = regexGroup(InputString,"\\{\\{ *([^{}]+?) *\\}\\}", 1 ) %}
Actual Output= match1
Expected Output= ["match1","match2","match3"]
----------------------------------------------------------
{% let Output = regexGroup(InputString,"\\{\\{ *([^{}]+?) *\\}\\}", 1 ) %} - This only returns the first matched element and not the array of all the matched strings inside {{}}.
Is there a way to achieve an array as output and not just first encountered matched value?
Just to make the ask concise and straightforward, my question is not related to regex to find the matched ids BUT A WAY TO RETURN MORE THAN ONE MATCHED VALUES IN FUNCTION - regexGroup(string, string, group) , as of now it takes the group value and since i have provided 1 in group , it returns the first value , but i wanted to get ALL the matched values with any regex format. Question is how to get and retrieve more than 1 matched values, may be with this function or by any other way?
