I have snippet javascript (web) but since i try to use RegExpression it should work almost the same.
I have a string with some coordinates in it seperated by a space charakter (last coordinate has no space after it).
var coords = "0:0 0:0:0 1:0:1 0:0:0:1 0:0:1 0:0:2";
var part = "0:0";
I want to have all the coordinates beginning with the value of part ("0:0") plus ":" and the next coordinate number. If a coordinate matches but has more than one additional "coordinate-dimensions" it shouldn't show...
For example it should show 0:0:0, 0:0:1 and 0:0:2 but NOT 0:0 (because to less dimension), 0:0:0:1 (because if the additional dimension)
What I tryed is something like:
var reg = new RegExp("(^|\\s)(0:0:\\d\\s)", "g");
alert(coords .match(reg));
But it seems not to work propperly.
Anyone has an idea?!
Kind regards!