Kenan Deen Kenan Deen - 13 days ago 5
C# Question

Regular expression for version numbers

I want to get such matches:

3.1.0
10.5.1
0.5


which may represent builds version numbering system.

Non-matches:

3.1.


I tried this regex:

[0-9]+\.[0-9]+


This gets only
0.5
but not
10.5.1
.

Answer

What about this:

\d+(?:\.\d+)+
Comments