Skip to content

Commit a00bd10

Browse files
authored
Merge pull request #5942 from DmitryOlshansky/faster-compile-regex
Faster to import std.regex, by lazy eval of wordMatcher merged-on-behalf-of: Petar Kirov <[email protected]>
2 parents a79876f + 881658e commit a00bd10

File tree

1 file changed

+5
-1
lines changed
  • std/regex/internal

1 file changed

+5
-1
lines changed

std/regex/internal/ir.d

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,11 @@ CharMatcher[CodepointSet] matcherCache;
4747
}
4848
}
4949

50-
static CharMatcher wordMatcher = CharMatcher(wordCharacter);
50+
@property ref wordMatcher()()
51+
{
52+
static CharMatcher matcher = CharMatcher(wordCharacter);
53+
return matcher;
54+
}
5155

5256
// some special Unicode white space characters
5357
private enum NEL = '\u0085', LS = '\u2028', PS = '\u2029';

0 commit comments

Comments
 (0)