Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
themeConfluence
languagejavascript
foo = "I like cheese";
my_str = "This is a string";
a = my_str.extract(re/(is)/) // a = ["is"]
b = my_str.extract(re/(s.+).*(.ing)/) // b = ["s is a st","ring"]
c = my_str.extract(re/(boot)/) // c = []
d = foo.extract(re/like (\w+)/) // d = ["cheese"]
e = foo.extract(re/(e)/g) // e = ["e","e","e","e"]

Note that if the regular expression does not contain at least one capture group, the resulting array will be empty.

...

Code Block
themeConfluence
languagejavascript
my_str = "This is a string";
my_str.substr(5);     // returns "is a string"
my_str.substr(5, 4);  // returns "is a"
my_str.substr(5, -5); // returns "is a s"
my_str.substr(25);    // returns null

...