Closed EuAndreh closed 9 years ago
I've also changed the if-match
macro: now it works nested:
* (when-match (#~m_a(b)c_ "abc")
(when-match (#~m_(f)(g)h_ "fgh")
(print $1)
(print $2))
(print $1)
t)
; "f"
; "g"
; "b"
; => T
* (when-match (#~m_a(b)c_ "abc")
(when-match (#~m_(f)(g)h_ "fgh")
(print $1)
(print $2))
(print $1)
(print $2)
t)
; "f"
; "g"
; "b"
; => ERROR: Too few matchs: $2 unbound.
Instead of an error, uncaptured variables could also return nil
.
Neat.
ppcre:scan-to-strings
gives a more practical usage to the#~m
macro, as far as pilfering Perl's syntax goes.