Function charRange

  • Match a character ranging from the first char to the second one.

    Escape sequences are supported and the two characters must be in order.

    Parameters

    • template: TemplateStringsArray
    • Rest ...args: unknown[]

    Returns HalfCharRangeFunction & IncompleteToken

    Example

    charRange`a` `z`
    charRange('a', 'z')

    RegExp equivalent:

    /[a-z]/
    

    Example

    Negated token

    notCharRange`a` `z`
    not.charRange`a` `z`
    notCharRange('a', 'z')

    RegExp equivalent:

    /[^a-z]/
    
  • Match a character ranging from the first char to the second one.

    Escape sequences are supported and the two characters must be in order.

    Parameters

    • start: string
    • end: string

    Returns RegExpToken

    Example

    charRange`a` `z`
    charRange('a', 'z')

    RegExp equivalent:

    /[a-z]/
    

    Example

    Negated token

    notCharRange`a` `z`
    not.charRange`a` `z`
    notCharRange('a', 'z')

    RegExp equivalent:

    /[^a-z]/
    
  • Match a character ranging from the first char to the second one.

    Escape sequences are supported and the two characters must be in order.

    Parameters

    • start: string

    Returns HalfCharRangeFunction & IncompleteToken

    Example

    charRange`a` `z`
    charRange('a', 'z')

    RegExp equivalent:

    /[a-z]/
    

    Example

    Negated token

    notCharRange`a` `z`
    not.charRange`a` `z`
    notCharRange('a', 'z')

    RegExp equivalent:

    /[^a-z]/
    

Generated using TypeDoc