Action: only access regexp group if it matched

Otherwise the result is None (which has no group method).