Skip to main content


ec_pcre_match — perform a regular expression match


ec_pcre_match { string } { pattern }


ec_pcre_match performs a regular expression match and returns a stringlist containing the matched strings. The zeroth element of the stringlist consists of the part of the string that matched the whole given pattern, the first element corresponds to the first captured subpattern, the second element to the second captured subpattern, and so on.

$email = "";
($a, $b, $c) = ec_pcre_match $email "(.*)@(.*)\.com";

# $a is "", $b is "foo" and $c is "bar"
ec_log "the string matched is ${a}, $1 is ${b}, $2 is ${c}.";
Was this page helpful?