digitalmars.D.bugs - regexp broken?
- Regan Heath (23/23) Mar 21 2005 import std.regexp;
import std.regexp; import std.stdio; void main() { char[] test = "test test"; char[][] tokens; tokens = test.split(r"[\s\t\r\n]"); foreach(char[] token; tokens) writefln("%s",token); } Gives: te t te t According to my understanding of: http://www.digitalmars.com/ctg/regular.html r"[\s\t\r\n]" should match any space, tab, carriage return or linefeed. But it seems to be interpreting \s as \char "matches char literally if char is not one of the above". In addition, consecutive delimiters leave blank strings in the results (as seen above \r\n), is this intentional? Regan
Mar 21 2005