Skip to content
Daniele Linguaglossa edited this page Jan 8, 2018 · 1 revision

Regex

Regex is the class used to interact with text and provide a regex-like interface.

Methods

Below the list of methods:

Match

Match is the method used to match a string against a regex it may return true or false, below an example:

// Signature
// Regex.Match(string value, string regex)

function test(base_request) {
  var matched = Regex.Match("this is an example!", "[a-z\s!]+")
  if(matched) {
    // Matched
  }
}

matchGroup

matchGroup unlike Match, matchGroup will return an array of matched groups, below an example:

// Signature
// Regex.Match(string value, string regex)

function test(base_request) {
  // Retrive matched groups
  var groups = Regex.matchGroup("this is an example!", "(is)")
  var is = groups[0];
}
Clone this wiki locally