digitalmars.D.learn - Using regexp over newlines
- Jesse Phillips (13/13) May 30 2009 Maybe this is a bug, but what I'm trying to do is select a substring tha...
Maybe this is a bug, but what I'm trying to do is select a substring that
contains any number of new lines between some other regular expression.
I'm doing this in D2
import std.stdio;
import std.regexp;
void main() {
string tester2 = r"W((.*\n.*)+)z";//gives me 3 separate matches not 1.
string tester = r"W(.*)z";
auto r_exp = (RegExp(tester, "gmi")).search("Waat\nda\nzza");
foreach(m; r_exp) {
writeln(m[1]);
}
}
May 30 2009








Jesse Phillips <jessekphillips gmail.com>