in reply to Re^4: Question on Regex grouping
in thread Question on Regex grouping

Also remember that if either (or both) or the regexes fail to match, one or the other (or both) of  $a and  $b (or whatever you finally decide to call them) will be undefined.