Es regex search

From EventScripts Community Encyclopedia


Overview

Syntax: es_regex search <variable> <expression> <string> [start] [range]

Note: Command parameters are described inside the < and > characters. Optional parameters are contained within [ and ] characters.

Variation of this command that doesn't expand variables: es_xregex match

Description

Searches for a regular expression within a certain section of the string.


Parameters

  • variable - the name of the variable to store the position that matched.
  • expression - a regular expression/pattern to match against
  • string -- the string to search
  • start -- optional position in the string to begin the search
  • range -- optional length from start for the number of characters to search


Examples

es_regex search myvar "[0-9]+" "Hello, I want 5 burgers." 3 99

Searches from position 3 to 99 for anything that matches a number and stores position of it in myvar.


Notes

  • If you provide either of the optional parameters, you should provide both.
  • Regular expressions are your friend. They're complicated like any good friend should be.
  • First available in v1.3 of EventScripts.


See also

blog comments powered by Disqus