Function hex

  • Match a character with the given code point in base-16.

    Notes:

    Both hex and unicode have the same effect, but hex uses the single-byte escape sequence \xff if possible, while unicode always uses the 2-byte sequence \uffff.

    Parameters

    • literal: string

    Returns RegExpToken

    Example

    hex`3f`
    hex('3f')

    RegExp equivalent:

    /\x3f/
    

    Example

    Negated token

    not.hex`3f`
    not(hex('3f'))

    RegExp equivalent:

    /[^\x3f]/
    
  • Match a character with the given code point in base-16.

    Notes:

    Both hex and unicode have the same effect, but hex uses the single-byte escape sequence \xff if possible, while unicode always uses the 2-byte sequence \uffff.

    Parameters

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

    Returns RegExpToken

    Example

    hex`3f`
    hex('3f')

    RegExp equivalent:

    /\x3f/
    

    Example

    Negated token

    not.hex`3f`
    not(hex('3f'))

    RegExp equivalent:

    /[^\x3f]/
    

Generated using TypeDoc