readable-regexp
TypeDocGitHubnpm
  • readable-regexp
  • Getting Started
    • Installation
    • Usage
  • API Reference
    • Character Classes
    • Anchors
    • Special Tokens
    • Quantifiers
    • Groups
    • Extras
    • TypeDoc
  • Custom Extensions
    • Custom Tokens
      • Step 1: Type Definition
      • Step 2: Implementation
      • Step 3: Usage
Powered by GitBook
On this page
  1. API Reference

Groups

Function
RegExp equivalent
Explanation

capture`foo` capture.exactly`foo` capture('foo')

(foo)

Wrap the given token in a capture group

captureAs`name` `foo` captureAs`name`.exactly`foo` captureAs('name')('foo')

(?<name>foo)

Wrap the given token in a named capture group

captureAs`name` `foo`.ref`name` capture`foo`.ref(1)

(?<name>foo)\k<name> (foo)\1

Supply a number to reference the capture group with that index. Supply a string to reference a named capture group.

group`foo` group.exactly`foo` group('foo')

(?:foo)

Wrap the given token in a non-capture group

ahead`foo` ahead.exactly`foo` ahead('foo')

(?=foo)

Wrap the given token in a positive lookahead

behind`foo` behind.exactly`foo` behind('foo')

(?<=foo)

Wrap the given token in a positive lookbehind

notAhead`foo` not.ahead`foo` notAhead.exactly`foo` notAhead('foo')

(?!foo)

Wrap the given token in a negative lookahead

notBehind`foo` not.behind`foo` notBehind.exactly`foo` notBehind('foo')

(?<!foo)

Wrap the given token in a negative lookbehind

oneOf`foo` `bar` oneOf(exactly`foo`, exactly`bar`) oneOf('foo', 'bar')

(?:foo|bar)

Match one in the provided list of options

PreviousQuantifiersNextExtras

Last updated 1 year ago