I am trying to get number i.e. 1.0.3 from string . I only want numbers that are formatted with two dots and have ver# before them. Is my regex implementation correct. It is work but will it fail in any condition?
var str = "https://example.x.y.com/z/ver#1.5.0";
var res = str.match(/ver#.\.(?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)/g);
return res;
#\d+\.\d+.\d+will be suffice. Demover#a.0.5whereas your original one does matchver#a.0.5. You are probably better off using theirs.