digitalmars.D.learn - Get "discarded" data from std.regex.splitter (or something else?)
- Steven Schveighoffer (6/6) Jan 16 2014 writeln(splitter("abc123def456", regex("[0-9]+", "g")));
- Dmitry Olshansky (7/13) Jan 16 2014 Well these 3 pieces are _slices_ of the original input, and with a bit
writeln(splitter("abc123def456", regex("[0-9]+", "g"))); outputs: ["abc", "def", ""] But what if I want the "123" and "456" tokens too? Is there a way to do that? -Steve
Jan 16 2014
17-Jan-2014 00:52, Steven Schveighoffer пишет:writeln(splitter("abc123def456", regex("[0-9]+", "g"))); outputs: ["abc", "def", ""] But what if I want the "123" and "456" tokens too? Is there a way to do that?Well these 3 pieces are _slices_ of the original input, and with a bit of calculations on .ptr and .length you can figure out what's in between. Also you can just use matchAll which too, does return slices. It could be seen as dropping all in between matches ;)-Steve-- Dmitry Olshansky
Jan 16 2014