Search code examples
c#regexstartswithends-with

Find text starts with "Column" and ends with any number (e.g. "100") and nothing between the two, using C#


I want to find texts (using C#), in a string, that starts with the word "Column" and ends any number (for example "100").

In short, I want to find:

Column1
Column100
Column1000

But not to find:

Column_1
_Column1
Column1$

I can't find a way to do it, using regular expressions.


Solution

  • This is practically as easy as regular expressions get.

    ^Column\d+$