c# - Extract all patterns using Regex -


i'm implementing pattern extraction particular string. pattern should start column( (which means particular column in excel data input) or cell( (which means particular cell in excel data input).

  • input string = "column(f)/100 + cell(b,2)/10"
  • expected output: column(f), cell(b,2).

source code:

list<string> result = new list<string>(); regex patternparser = new regex(@"(?:column\()\s+\).+?|(?:cell\()\s+\).+?", regexoptions.compiled | regexoptions.ignorecase); foreach (match m in patternparser.matches(vareval)) {      result.add(m.value); } 

i got result: column(f)/ , cell(b,2)/.

\b(?:column|cell)\b\(.*?\) 

you can this.see demo.

https://regex101.com/r/mt0ie7/26


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -