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 5 Next »

Engine Compatibility

The Node pico engine only accepts an enclosing pound sign.


Regular expressions are enclosed in matching characters with a prepended re. The conventional character for enclosing a regular expression is a slash (/), but a pound sign (#) can be used as well: re/.../ or re#...#. KRL regular expressions closely follow 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