Convenience function that creates a shared cached and returns an object containing cached version of all available-to-wrap functions

  • Parameters

    Returns {
        parseToRegexOrLiteralSearch: ((val: string, options??: string | LiteralSearchOptions) => RegExp);
        testMaybeRegex: ((test: string, subject: string, options??: string | LiteralSearchOptions) => [boolean, string]);
        searchAndReplace: ((val: string, ops: SearchAndReplaceRegExp[], options??: string | LiteralSearchOptions) => string);
    }

    • parseToRegexOrLiteralSearch: ((val: string, options??: string | LiteralSearchOptions) => RegExp)
        • (val, options?): RegExp
        • Tries to parse a string as a regular expression. If this fails it tries to convert the string into a Regular Expression with a literal search for the string value.

          Parameters

          • val: string

            The string to parse

          • Optionaloptions: string | LiteralSearchOptions = {}

            Options related to how to parse the string value for the literal search

          Returns RegExp

    • testMaybeRegex: ((test: string, subject: string, options??: string | LiteralSearchOptions) => [boolean, string])
        • (test, subject, options?): [boolean, string]
        • Tries to parse a string as a regular expression, falling back to literal search, and then tests a given value

          Returns a tuple of [matchedExpressionBool,matchedValString]

          Parameters

          • test: string

            The string to use a regular expression

          • subject: string

            The string to test with the regular expression

          • Optionaloptions: string | LiteralSearchOptions = {}

            Options related to how to parse the string value for the literal search

          Returns [boolean, string]

    • searchAndReplace: ((val: string, ops: SearchAndReplaceRegExp[], options??: string | LiteralSearchOptions) => string)
        • (val, ops, options?): string
        • Perform one or more search-and-replace operations on a string where the 'search' value may be a regular expression, a string to parse as a regular expression, or a string to use as a literal search expression

          Parameters

          • val: string

            The string to perform search-and-replace operations on

          • ops: SearchAndReplaceRegExp[]

            An array of search-and-replace criteria

          • Optionaloptions: string | LiteralSearchOptions = {}

            Options related to how to parse the string value for the literal search

          Returns string