Skip to main content

MustCreateRegex

Compiles a case-insensitive regular expression pattern for a given variable name, ensuring it matches the format {{.$varName}} or {{$varName}}.

def MustCreateRegex(
varName: string
) - > *regexp.Regexp

Builds a case-insensitive regular expression that matches a variable placeholder in the format {{ .$VARNAME }} or {{ $VARNAME }}. This function is used to create regex patterns for parsing template-like strings.

Parameters

NameTypeDescription
varNamestringThe name of the variable to be embedded in the regular expression. This name will be matched case-insensitively within the placeholder.

Returns

TypeDescription
*regexp.RegexpA compiled regular expression object that can be used for matching.