regexp
Regular expressions
Prev:A quick introduction to regular expressions
Next:Regular expression syntax


Vocabulary
regexp

Class description
The class of regular expressions. To construct these, see Constructing regular expressions.

Definition
IN: regexp

TUPLE: regexp
{ raw read-only } { parse-tree read-only }
{ options read-only } dfa next-match ;


Methods
USING: accessors kernel regexp regexp.compiler regexp.negation
regexp.private ;

M: regexp compile-regexp
dup [ [ drop ] ] dip [ get-ast ast>dfa dfa>word ] curry
compose [ [ dup \ regexp-initial-word = ] ] dip
[ when ] curry compose change-dfa ;


USING: kernel regexp regexp.private sequences ;

M: regexp end/start drop length 0 ;


USING: kernel regexp regexp.private ;

M: regexp match-iterator-start 2drop 0 ;


USING: accessors kernel make prettyprint.backend
prettyprint.custom regexp regexp.parser regexp.private ;

M: regexp pprint*
[
[
[ raw>> dup find-regexp-syntax swap % swap % % ]
[ options>> options>string % ] bi
] "" make
] keep present-text ;


USING: kernel regexp xmode.rules ;

M: regexp text-hash-char drop f ;


USING: accessors kernel regexp strings xmode.marker ;

M: regexp text-matches?
[ >string ] dip first-match dup [ to>> ] when ;