1 USING: help.markup help.syntax math sequences strings ;
4 ARTICLE: "pcre" "PCRE binding"
5 "The " { $vocab-link "pcre" } " vocab implements a simple binding for libpcre, enabling rich regular expression support for Factor applications." $nl
6 "Precompiling and optimizing a regular expression:"
7 { $subsections <compiled-pcre> }
11 "\"foobar\" \"\\\\w\" findall"
14 { $notes "Regular expressions are by default utf8 and unicode aware." } ;
17 { $values { "expr" string } { "compiled-pcre" compiled-pcre } }
18 { $description "Creates a precompiled regular expression object." } ;
23 { "obj" "a string, compiled regular expression or a regexp literal" }
24 { "matches" sequence }
26 { $description "Finds all matches of the given regexp in the string. Matches is sequence of associative array where the key is the name of the capturing group, or f to denote the full match." }
30 "\"foobar\" \"(?<ch1>\\\\w)(?<ch2>\\\\w)\" findall ."
32 " { { f \"fo\" } { \"ch1\" \"f\" } { \"ch2\" \"o\" } }"
33 " { { f \"ob\" } { \"ch1\" \"o\" } { \"ch2\" \"b\" } }"
34 " { { f \"ar\" } { \"ch1\" \"a\" } { \"ch2\" \"r\" } }"
40 { $values { "f" float } }
41 { $description "Version number of the PCRE library, expressed as a float." } ;