File tree 1 file changed +8
-9
lines changed
1 file changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -260,21 +260,20 @@ $(GNAME ElseStatement):
260
260
initialized to the end of the $(I ThenStatement).)
261
261
262
262
---
263
- import std.regexp ;
263
+ import std.regex ;
264
264
...
265
- if (auto m = std.regexp.search ("abcdef", "b(c)d"))
265
+ if (auto m = std.regex.matchFirst ("abcdef", "b(c)d"))
266
266
{
267
- writefln("[%s]", m.pre); // prints [a]
268
- writefln("[%s]", m.post); // prints [ef]
269
- writefln("[%s]", m.match(0)); // prints [bcd]
270
- writefln("[%s]", m.match(1)); // prints [c]
271
- writefln("[%s]", m.match(2)); // prints []
267
+ writefln("[%s]", m.pre); // prints [a]
268
+ writefln("[%s]", m.post); // prints [ef]
269
+ writefln("[%s]", m[0]); // prints [bcd]
270
+ writefln("[%s]", m[1]); // prints [c]
272
271
}
273
272
else
274
273
{
275
- writeln(m.post); // error, m undefined
274
+ writeln(m.post); // Error: undefined identifier 'm'
276
275
}
277
- writeln(m.pre); // error, m undefined
276
+ writeln(m.pre); // Error: undefined identifier 'm'
278
277
---
279
278
280
279
$(H3 $(LEGACY_LNAME2 WhileStatement, while-statement, While Statement))
You can’t perform that action at this time.
0 commit comments