Handbook
Glossary
<optioned-regexp> ( string options -- regexp )
Regular expressions
ยป
Constructing regular expressions
Prev:
<regexp> ( string -- regexp )
Vocabulary
regexp
Inputs
string
a
string
options
a string of
Regular expression options
Outputs
regexp
a
regexp
Word description
Given a string in regular expression syntax, and a string of options, creates a regular expression object. When it is first used for matching, a DFA is compiled, and this DFA is stored for reuse so it is only compiled once.
Definition
USING:
accessors
kernel
regexp.ast
regexp.parser
sequences
;
IN:
regexp
:
<optioned-regexp>
( string options -- regexp )
[
dup
parse-regexp
]
[
string>options
]
bi*
dup
on>>
reversed-regexp
swap
member?
[
reverse-regexp
new-regexp
]
[
regexp
new-regexp
]
if
;