if( $extract =~/^\( (\d.+) \)$/ ) { print "The number was $1"; } else { print "The regex didn't match"; }