Btw you don't have to specify pattern name in $regex and $regml, because $regml lets you reference to the last regex match: //if $regex(a,(\w)) { echo -a $regml(1) }