File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -41,9 +41,12 @@ let preprocessRegexes = [
41
41
[ / [ \t ] + \\ s \+ [ \t ] + / g, '\\s+' ] ,
42
42
43
43
// 1+ spaces/tabs are instead interpreted as \s* (0+ whitespace)
44
- // The (\\s\*)? expressions before and after it are an optimization -
44
+ // The (?: \\s\*)? expressions before and after it are an optimization -
45
45
// if you use \s* next to spaces/tabs, they coalesce for speed.
46
- [ / ( \\ s \* ) ? [ \t ] + ( \\ s \* ) ? / g, '\\s*' ]
46
+ // We use non-capturing groups (?:...) for speed. Preprocessing is only
47
+ // done once on startup, so speed isn't important, but it's often good
48
+ // to avoid capturing groups when you don't need to.
49
+ [ / (?: \\ s \* ) ? [ \t ] + (?: \\ s \* ) ? / g, '\\s*' ]
47
50
] ;
48
51
49
52
/**
Original file line number Diff line number Diff line change @@ -608,5 +608,8 @@ in this example:
608
608
The optional expressions before and after it are an optimization,
609
609
to coalesce this for speed.
610
610
611
+ In the preprocessing replacement text, you can use `$` followed by a digit
612
+ to refer to the corresponding capturing group.
613
+
611
614
If you load `hello.html` you'll automatically run some self-tests on
612
615
the default preprocessor.
You can’t perform that action at this time.
0 commit comments