@@ -190,9 +190,10 @@ The only way to parse the RegExp despite unresolvable backreferences is to remov
190190
191191``` ts
192192const regex = / (#+ ). * \1 | foo/ ;
193- const parseResult = JS .Parser .fromLiteral (regex ).parse ({ backreferences: " disable" });
193+ const { expression } =
194+ JS .Parser .fromLiteral (regex ).parse ({ backreferences: " disable" });
194195
195- console .log (JS .toLiteral (parseResult . expression ));
196+ console .log (JS .toLiteral (expression ));
196197// => { source: 'foo', flags: '' }
197198```
198199
@@ -217,7 +218,8 @@ Similarly to backreferences, we can let the parser remove them:
217218
218219``` ts
219220const regex = / \b (?!\d )\w + \b | ->/ ;
220- const { expression, maxCharacter } = JS .Parser .fromLiteral (regex ).parse ({ assertions: " disable" });
221+ const { expression, maxCharacter } =
222+ JS .Parser .fromLiteral (regex ).parse ({ assertions: " disable" });
221223
222224console .log (JS .toLiteral (expression ));
223225// => { source: '->', flags: 'i' }
@@ -277,8 +279,10 @@ console.log(JS.toLiteral(modifiedExpression));
277279// The only assertions left assert characters beyond the edge of the pattern.
278280// Removing those assertions is easy but slightly changes the pattern.
279281
280- const edgeAssertionTransformer = Transformers .patternEdgeAssertions ({ remove: true });
281- const finalExpression = transform (edgeAssertionTransformer , modifiedExpression );
282+ const finalExpression = transform (
283+ Transformers .patternEdgeAssertions ({ remove: true }),
284+ modifiedExpression
285+ );
282286
283287console .log (JS .toLiteral (finalExpression ));
284288// => { source: '[A-Z_]\\w*|->', flags: 'i' }
0 commit comments