I have a question according to this link http://support.microsoft.com/kb/188997 ( A computer name can be up to 15 alphanumeric characters with no blank spaces. The name must be unique on the network and can contain the following special characters: ! @ # $ % ^ & ( ) - _ ' { } . ~
The Following characters are not allowed: \ * + = | : ; " ? < > , )
and I am developing in C++
so i used the following code but when i input character which isn't allowed.. it is matched ! why ?
regex rgx("[a-zA-Z0-9]*(!|@|#|$|%|^|&|\(|\)|-|_|'|.|~|\\{|\\})*[a-zA-Z0-9]*");
string name;
cin>>name;
if (regex_match(name, rgx))
{
cout << " Matched :) " << endl;
}
else
cout << "Not Matched :(" << endl;
your help will be greatly appreciated :)