Namespace: wildstring

wildstring

Properties:
Name Type Description
wildcard string

the wildcard to use in your strings, defaults to '*'

caseSensitive boolean

whether matches should care about case, defaults to true

Source:

Methods


<private, static> checkRollbackStrings(rollbackStrings, patternSubstrings)

When a match doesn't continue to the end of the string, this function rolls back to try again with the rest of the string

Parameters:
Name Type Description
rollbackStrings Array.<string>

The list of substrings that appeared prior to the current match

patternSubstrings Array.<string>

The matching list of pattens that need to be matched before the current pattern

Source:

<static> match(pattern, string)

Check if a string matches a pattern

Parameters:
Name Type Description
pattern string

The pattern to match using the configured wildcard

string string

The string to test for a match

Source:

<static> replace(pattern, strings)

Replace wildcards in a pattern with strings (string interpolation)

Parameters:
Name Type Description
pattern string

The start string, using wildcards as placeholders

strings string | Array.<string>

The string or strings to replace the wildcards in the pattern.
If you pass a single string, it will replace all the wildcards with the string.
If you pass an array of strings, they will replace the wildcards in order from left to right.

Source:
Throws:
  • The number of items in the strings array (if you pass an array) must match the number of wildcards in the pattern string.

  • You need to pass both parameters

  • You need to pass the right types