• Defines a new string-struct matching a regular expression.

    Example:

    const EthAddressStruct = definePattern('EthAddress', /^0x[0-9a-f]{40}$/iu);
    

    Parameters

    • name: string

      Type name.

    • pattern: RegExp

      Regular expression to match.

    Returns Struct<string, null>

    A new string-struct that matches the given pattern.