Options
All
  • Public
  • Public/Protected
  • All
Menu

Class AbstractRegex

Support for regex matching. Subclasses can convert the value to whatever type they require.

Hierarchy

Implements

Index

Constructors

Properties

Accessors

Methods

Constructors

constructor

  • new AbstractRegex(regex: RegExp, lookahead?: number, parseNodeName?: string): AbstractRegex
  • Match a regular expression

    Parameters

    • regex: RegExp

      JavaScript regex to match. Don't use an end anchor. Start anchor will be added if not already there

    • Default value lookahead: number = LOOK_AHEAD_SIZE

      number of characters to pull from the input to try to match. We'll keep grabbing more if a match is found for the whole string

    • Optional parseNodeName: string

    Returns AbstractRegex

Properties

Private lookahead

lookahead: number

number of characters to pull from the input to try to match. We'll keep grabbing more if a match is found for the whole string

Protected parseNodeName

parseNodeName: string

regex

regex: RegExp

Accessors

$id

  • get $id(): string

Methods

matchPrefix

matchPrefixReport

Protected Abstract toValue

  • toValue(s: string): any
  • Subclasses will override this to convert the string value from a successful match to any type they require. This enables safe creation of custom types.

    Parameters

    • s: string

      raw string resulting from a successful match

    Returns any

Generated using TypeDoc