Constructing regular expressions
Regular expressions

Prev:Regular expression options
Next:Matching operations with regular expressions

Most of the time, regular expressions are literals and the parsing word should be used, to construct them at parse time. This ensures that they are only compiled once, and gives parse time syntax checking.

Sometimes, regular expressions need to be constructed at run time instead; for example, in a text editor, the user might input a regular expression to search for in a document.
<regexp> ( string -- regexp )

<optioned-regexp> ( string options -- regexp )

Another approach is to use regexp.combinators.