TheUninvited
Active Coder
We have this text:
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…
we use this command of regex to grab them :
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 ?
regex101.com
Code:
<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 ?
Code:
int num;
Regex myRegex = new Regex(@"(\${num)(.*?)(?=})");
regex101: PCRE (Legacy) Match Workspace
Explore and test this PCRE (Legacy) regular expression online. Understand the pattern with regex explanations, generate code, and export matches to CSV or JSON.
Last edited: