···248248| `(?= )` | `(?= ${/1/})` | A **positive lookahead** checks whether interpolations match, and if so continues the matcher without changing the input. If it matches, it's essentially ignored. |
249249| `(?! )` | `(?! ${/1/})` | A **negative lookahead** checks whether interpolations _don't_ match, and if so continues the matcher without changing the input. If the interpolations do match the matcher is aborted. |
250250251251+A couple of operators also support "short hands" that allow you to write
252252+lookaheads or non-capturing groups a little quicker.
253253+254254+| Shorthand | Example | Description |
255255+| --------- | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
256256+| `:` | `:${/1/}` | A **non-capturing group** is like a regular group, but the interpolations matched inside it don't appear in the parser's output. |
257257+| `=` | `=${/1/}` | A **positive lookahead** checks whether interpolations match, and if so continues the matcher without changing the input. If it matches, it's essentially ignored. |
258258+| `!` | `!${/1/}` | A **negative lookahead** checks whether interpolations _don't_ match, and if so continues the matcher without changing the input. If the interpolations do match the matcher is aborted. |
259259+251260We can combine and compose these operators to create more complex matchers.
252261For instance, we can extend the original example to only allow a specific set
253262of names by using the `|` operator:
···345354346355We've now entirely changed the output of the parser for this matcher. Given that each
347356matcher can change its output, we're free to change the parser's output entirely.
348348-By **returning a falsy value** in this matcher, we can also change the matcher to not have
349349-matched, which would cause other matchers to treat it like a mismatch!
357357+By returning `null` or `undefined` in this matcher, we can also change the matcher
358358+to not have matched, which would cause other matchers to treat it like a mismatch!
350359351360```js
352361import { match, parse } from 'reghex';
···374383tag(['test'], 'node_name');
375384// ["test", .tag = "node_name"]
376385```
386386+387387+### Tagged Template Parsing
388388+389389+Any grammar in RegHex can also be used to parse a tagged template literal.
390390+A tagged template literal consists of a list of literals alternating with
391391+a list of "interpolations".
392392+393393+In RegHex we can add an `interpolation` matcher to our grammars to allow it
394394+to parse interpolations in a template literal.
395395+396396+```js
397397+import { interpolation } from 'reghex';
398398+399399+const anyNumber = interpolation((x) => typeof x === 'number');
400400+401401+const num = match('num')`
402402+ ${/[+-]?/} ${anyNumber}
403403+`;
404404+405405+parse(num)`+${42}`;
406406+// ["+", 42, .tag = "num"]
407407+```
408408+409409+This grammar now allows us to match arbitrary values if they're input into the
410410+parser. We can now call our grammar using a tagged template literal themselves
411411+to parse this.
377412378413**That's it! May the RegExp be ever in your favor.**