Skip to content

Commit 8157f8e

Browse files
authored
Merge pull request #1413 from BBasile/issue-16231
fix issue 16231 - rename std.regexp to std.regex in a code example
2 parents bd690dc + 5dd6ee3 commit 8157f8e

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

spec/statement.dd

+8-9
Original file line numberDiff line numberDiff line change
@@ -260,21 +260,20 @@ $(GNAME ElseStatement):
260260
initialized to the end of the $(I ThenStatement).)
261261

262262
---
263-
import std.regexp;
263+
import std.regex;
264264
...
265-
if (auto m = std.regexp.search("abcdef", "b(c)d"))
265+
if (auto m = std.regex.matchFirst("abcdef", "b(c)d"))
266266
{
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]
272271
}
273272
else
274273
{
275-
writeln(m.post); // error, m undefined
274+
writeln(m.post); // Error: undefined identifier 'm'
276275
}
277-
writeln(m.pre); // error, m undefined
276+
writeln(m.pre); // Error: undefined identifier 'm'
278277
---
279278

280279
$(H3 $(LEGACY_LNAME2 WhileStatement, while-statement, While Statement))

0 commit comments

Comments
 (0)