in reply to Reg Exp

Of course $test1 doesn't match, because the parenthesis are mandatory in the regex.

So you have to make them optional. But that menas that the the first .* will suck up all of the regex, so you have to find a compromise. The one I chose below is to allow everything but digits and opening parenthesis in the first chunk:

#!/usr/bin/perl use strict; use warnings; my @tests = ("Server list (Win2K/Win2003/XP) 6.26.5.1.5", "Server list + 6.26.5.1.5"); for (@tests){ if (m/([^(\d]+) ((?:\([^)]+\))?) (.*)/x){ print "$1|$2|$3\n" } else { print "No match for $_\n"; } } __END__ Server list |(Win2K/Win2003/XP)| 6.26.5.1.5 Server list ||6.26.5.1.5