We have this text:
> <snippet>
> <content><![CDATA[
> ${1:first}, ${2:second} ${3:second}
> ]]></content>
> <!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
> <tabTrigger>2p</tabTrigger>
> <!-- Optional: Set a scope to limit where the snippet will trigger -->
> <!-- <scope>source.python</scope> -->
> </snippet>
I want to grab this elements and add them to a list is my goal but only add them in the list if the number exist , the elements could be 4 or 5 or 10 it doesn’t matter…
${1:first}
${2:second}
${3:second}
we use this command of regex to grab them :
Regex myRegex = new Regex(@"`(\${)(.*?)(?=})`");
and somehow i want to use a counter like to search through , i want something like this ,but i know is not possible because it doesn’t work exactly like that…so any ideas how can i do that in c#? or in general ?
int num;
Regex myRegex = new Regex(@"(\${num)(.*?)(?=})");
https://regex101.com/r/VkUvlX/1