Please read the positing guidelines : http://regexadvice.com/forums/thread/58291.aspx IT IS IMPOSSIBLE TO WRITE A REGULAR EXPRESSION IF THE INPUT DATA IS UNKNOWN.
e.g. what is the input string. What characters does it use ? Is it a UNC pathname ? Do you require a min/max length limit to the name you want to use ? Is it a name already validated or a user input that could contain malicious sequences ? Is \\?\ something you expect to filter ? is \\.\ something you expect to filter ? is \\ftp: something you expect to filter? Are your function responsible for provising a valid name to the application ? Or someone else will validate the name ? And so on ... I WARN YOU : there is no way to separate a server name from the protocol and from the folders in the general case. Only functions provided by the OS would guarantee you that what you are doing is correct.
The regular expression for autoit seems to be documented here, looks to be pcre commpliant http://www.autoitscript.com/autoit3/docs/functions/StringRegExp.htm
Build your regular expression as follows
^ match the beginning of the buffer
\\\\ match the 2 first \ \
[^\\]+ any byte, but not a \ , repeated at least 1 time
\\ the first \ after the host
.* anything after
Concatenate the whole lot to get the complete regular expression
^(\\\\[^\\]+)\\.*
Then if the input is
\\Host\folder1\folder2
$array = StringRegExp(.....) would return the following string in $array[0]
\\Host
Please read carefully the beginning of this mail, this expression will NOT guarantee that the name is a valid server name . this regular expression matches only YOUR descriptioon of the problem.