pcre: support for the regexp literal syntax from the regexp vocab
parent
0c08896981
commit
6748bc4bc7
|
@ -10,6 +10,7 @@ USING:
|
|||
sequences
|
||||
system
|
||||
tools.test ;
|
||||
QUALIFIED: regexp
|
||||
IN: pcre.tests
|
||||
|
||||
CONSTANT: iso-date "(?P<year>\\d{4})-(?P<month>\\d{2})-(?P<day>\\d{2})"
|
||||
|
@ -117,3 +118,6 @@ os unix? [ [ 10 ] [ PCRE_CONFIG_NEWLINE config ] unit-test ] when
|
|||
"http://factorcode.org/" http-get nip
|
||||
"href=\"(?P<link>[^\"]+)\"" findall [ "link" of ] map sequence?
|
||||
] unit-test
|
||||
|
||||
! Test that the regexp syntax works.
|
||||
[ t ] [ "1234abcd" regexp:R[ ^\d+\w+$] matches? ] unit-test
|
||||
|
|
|
@ -10,6 +10,7 @@ USING:
|
|||
pcre.ffi pcre.info pcre.utils
|
||||
sequences sequences.generalizations
|
||||
strings ;
|
||||
QUALIFIED: regexp
|
||||
IN: pcre
|
||||
|
||||
ERROR: malformed-regexp expr error ;
|
||||
|
@ -90,6 +91,9 @@ M: compiled-pcre findall
|
|||
M: string findall
|
||||
<compiled-pcre> findall ;
|
||||
|
||||
M: regexp:regexp findall
|
||||
raw>> findall ;
|
||||
|
||||
: matches? ( subject obj -- ? )
|
||||
dupd findall [ nip length 1 = ] [ ?first ?first ?last = ] 2bi and ;
|
||||
|
||||
|
|
Loading…
Reference in New Issue