Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 7 Next »

Regular expressions are enclosed in matching pound sign (#) characters with a prepended re: re#...#. KRL regular expressions follow the JavaScript standard, which closely follows the conventions for Perl regular expressions. The following modifiers may appear after the closing character:

  • i. The i modifier makes the regular expression case insensitive.
  • g. The g modifier applies the regular expression globally.

For example, the following code replaces the first instance of foo in p with bar:

p.replace(re#foo#, "bar")

In contrast, the following code replaces all instances of foo in p with bar:

p.replace(re#foo#g, "bar")
  • No labels