MUDBRINGER
Menu

Regex

P_regex

Syntax

@regex({pattern}, {text})

Use Case:

Tests if a regular expression pattern matches the provided text. Returns 1 if a match is found, 0 otherwise.

Arguments:

  • {pattern}: The regex pattern.
  • {text} : The text to test.

Examples:

  1. /if {@regex(^[0-9]+$, $input)} {/echo Number}

See Also:

regexmatch

P_regexmatch

Syntax

@regexmatch({pattern}, {text})

Use Case:

Performs a regex match and populates the global ‘RegexSubMatches’ array with any capture groups found. Returns the full match string.

Arguments:

  • {pattern}: The regex pattern (with groups).
  • {text} : The text to match.

Examples:

  1. /var {full} {@regexmatch((\d+)hp, 100hp)}

See Also:

regex