@@ -368,21 +368,6 @@ RegExp.prototype[Symbol.customMatcher] = function(subject, {matchType}) {
368368```
369369
370370
371- ### Regex Patterns
372-
373- A regex pattern is a regex literal,
374- representing a test that the subject,
375- when stringified,
376- successfully matches the regex.
377-
378- (Technically, this just invokes the ` RegExp.prototype[Symbol.customMatcher] ` method;
379- that is, ` x is /foo/; ` and ` let re = /foo/; x is re; `
380- are identical in behavior wrt built-in fiddling.)
381-
382- A regex pattern can be followed by a parenthesized pattern list,
383- identical to [ extractor patterns] ( #extractor-patterns ) .
384- See that section for details on how this works.
385-
386371#### Examples
387372
388373``` js
@@ -892,53 +877,6 @@ and returns the `[subject.value]` on success.
892877That' s a silly amount of work for correctness.
893878
894879
895- ### Regex Extractor Patterns
896-
897- Similar to how [regex patterns](#regex- patterns)
898- allowed you to use a regex literal as a pattern,
899- but simply invoked the normal [custom matcher](#custom- matchers) machinery,
900- a regex literal can also be followed by an [arglist pattern](#arglist- patterns),
901- invoking the normal [extractor pattern](#extractor- patterns) machinery.
902-
903- For this purpose,
904- on a successful match
905- the " return value" (what' s matched against the arglist pattern)
906- is an Array whose items are the regex result object,
907- followed by each of the positive numbered groups in the regex result
908- (that is, skipping the "0" group that represents the entire match).
909-
910- Execution order is identical to [extractor patterns](#extractor-patterns),
911- except the first part is matched as a [regex pattern](#regex-patterns),
912- and the second part' s subject is as defined above.
913-
914- The full definition of the ` RegExp.prototype` custom matcher is thus:
915-
916- ` ` ` js
917- RegExp.prototype[Symbol.customMatcher] = function(subject) {
918- const result = this.exec(subject);
919- if(result) {
920- return [result, ...result.slice(1)];
921- } else {
922- return false;
923- }
924- }
925- ` ` `
926-
927- #### Examples
928-
929- ` ` ` js
930- match (arithmeticStr) {
931- when /(?<left>\d +) \+ (?<right>\d +)/({groups:{let left, let right}}):
932- // Using named capture groups
933- processAddition(left, right);
934- when /(\d +) \* (\d +)/({}, let left, let right):
935- // Using positional capture groups
936- processMultiplication(left, right);
937- default: ...
938- }
939- ` ` `
940-
941-
942880## Combinator Patterns
943881
944882Sometimes you need to match multiple patterns on a single value,
0 commit comments