Pattern pattern = Pattern.compile("^(?:[:@]([^\\s]+) )?([^\\s]+)(?: ((?:[^:\\s][^\\s]* ?)*))?(?: ?:(.*))?$");
Matcher matcher = pattern.matcher(line.subSequence(0, line.length()));
 
if (matcher.matches()) {
	//i.e irc.mibbit.net
	source = matcher.group(1);
	//i.e 433/NOTICE
	cmd = matcher.group(2);
	//i.e Nickname/#channel
	target = matcher.group(3);
	//i.e I have 3093 clients and 1 servers
	param = matcher.group(4);
}

I use this regex for an IRC bot I created. Above is an example in JAVA. It makes use of the following regex: ^(?::@ )?([^\s]+)(?: ((?:[^:\s][^\s]* ?)))?(?: ?:(.))?$

It will match 4 groups (source, command, target and the parameters).

Examples in other languages and better solutions are welcome.