I'm trying to match release versions using regex but exclude any string or group in a string that might have underscore after version number. The pattern is n.n(optionally additional .n) and nothing else, aka major.minor version and additionally build version. Update: Additionally if possible, letters can be allowed but only after n.n or n.n.n for example n.na or n.n.na but not any other combination.
For example:
1.2.3
10.2.4
10.20.5
10.20.323
1.20.30
1.2.33
1.0
1.2a
1.1.2a
1.22_UAT_2
1.10.2_TEST1
1.2_UAT2
2.0_LIVE_2_
a line with text which has 1.2 or then 1.2.1 but then 1.2.1_UAT2 or 1.3_TEST also include version as 1.3a or 1.4.1b but not 1.2a_UAT3 and not 1.2b_1 or 1.2.3a_b
Should return:
1.2.3
10.2.4
10.20.5
10.20.323
1.20.30
1.2.33
1.0
1.2a
1.1.2a
1.2
1.2.1
1.3a
1.4.1b