var coords = "0:0 0:0:0 1:0:1 1:0:0 0:0:0:1";var part = "0:0";var reg = new RegExp("(^|\\s)(" + part + "\\S*)", "g");print(coords.match(reg));
Standard input is empty
0:0, 0:0:0, 0:0:0:1
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!