RosettaCodeData/Task/Regular-expressions/Argile/regular-expressions.argile
Ingy döt Net b83f433714 tasks a-s
2013-04-10 23:57:08 -07:00

22 lines
376 B
Text

use std, regex
(: matching :)
if "some matchable string" =~ /^some" "+[a-z]*" "+string$/
echo string matches
else
echo string "doesn't" match
(: replacing :)
let t = strdup "some allocated string"
t =~ s/a/"4"/g
t =~ s/e/"3"/g
t =~ s/i/"1"/g
t =~ s/o/"0"/g
t =~ s/s/$/g
print t
free t
(: flushing regex allocations :)
uninit regex
check mem leak; use dbg (:optional:)