Function control

  • Match a control character with value equal to the given letter's character value modulo 32. Only a letter from a to z or A to Z is allowed.

    For example, \cJ represents line break (\n), because the code point of J is 74, and 74 modulo 32 is 10, which is the code point of line break. Because an uppercase letter and its lowercase form differ by 32, \cJ and \cj are equivalent. You can represent control characters from 1 to 26 in this form.

    ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Regular_expressions/Character_escape#description )

    Parameters

    • literal: Alphabet

    Returns RegExpToken

    Example

    control`j`
    control('j')
    control`J`
    control('J')

    RegExp equivalent:

    /\cj/
    /\cJ/

    Example

    Negated token

    not.control`j`
    not(control('j'))
    not.control`J`
    not(control('J'))

    RegExp equivalent:

    /[^\cj]/
    /[^\cJ]/
  • Match a control character with value equal to the given letter's character value modulo 32. Only a letter from a to z or A to Z is allowed.

    For example, \cJ represents line break (\n), because the code point of J is 74, and 74 modulo 32 is 10, which is the code point of line break. Because an uppercase letter and its lowercase form differ by 32, \cJ and \cj are equivalent. You can represent control characters from 1 to 26 in this form.

    ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Regular_expressions/Character_escape#description )

    Parameters

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

    Returns RegExpToken

    Example

    control`j`
    control('j')
    control`J`
    control('J')

    RegExp equivalent:

    /\cj/
    /\cJ/

    Example

    Negated token

    not.control`j`
    not(control('j'))
    not.control`J`
    not(control('J'))

    RegExp equivalent:

    /[^\cj]/
    /[^\cJ]/

Generated using TypeDoc