Review and fix regular expressions of the form /^foo|bar$/.
Replace regular expressions with simple string comparisons where
possible.
Use '(?:subregexp)' instead of '(subregexp)' wherever possible.
'dlls/gdi' does not have a win16drv subdirectory anymore so simplify
regular expressions accordingly.

diff --git a/tools/winapi_check/modules.pm b/tools/winapi_check/modules.pm
index 6f2b990..06121b9 100644
--- a/tools/winapi_check/modules.pm
+++ b/tools/winapi_check/modules.pm
@@ -71,7 +71,7 @@
 	/^$/ && next;
 
 	if($header)  {
-	    if(/^\d+|@/) { $header = 0; $lookahead = 1; }
+	    if(/^(?:\d+|@)/) { $header = 0; $lookahead = 1; }
 	    next;
 	}
 
diff --git a/tools/winapi_check/nativeapi.pm b/tools/winapi_check/nativeapi.pm
index 198a767..4b8b80b 100644
--- a/tools/winapi_check/nativeapi.pm
+++ b/tools/winapi_check/nativeapi.pm
@@ -207,7 +207,7 @@
 
     my @messages;
     foreach my $name (sort(keys(%$conditionals))) {
-	if($name =~ /^const|inline|size_t$/) { next; }
+	if($name =~ /^(?:const|inline|size_t)$/) { next; }
 
 	if(0 && !$$conditional_found{$name}) {
 	    push @messages, "config.h.in: conditional $name not used\n";
diff --git a/tools/winapi_check/winapi_check b/tools/winapi_check/winapi_check
index 7467502..7d980e9 100755
--- a/tools/winapi_check/winapi_check
+++ b/tools/winapi_check/winapi_check
@@ -477,7 +477,7 @@
 
 	if($options->config) {
 	    if(!$nativeapi->is_conditional($_)) {
-		if(/^HAVE_/ && !/^HAVE_(IPX|MESAGL|BUGGY_MESAGL|WINE_CONSTRUCTOR)$/)
+		if(/^HAVE_/ && !/^HAVE_(?:IPX|MESAGL|BUGGY_MESAGL|WINE_CONSTRUCTOR)$/)
 		{
 		    $output->write("$file: $_ is not declared as a conditional\n");
 		}
@@ -556,7 +556,7 @@
 
 		if($check_protection && $header) {
 		    if((-e "$wine_dir/include/$header" || -e "$wine_dir/$file_dir/$header")) {
-			if($header !~ /^(oleauto\.h|win(?:base|def|error|gdi|nls|nt|user)\.h)$/ &&
+			if($header !~ /^(?:oleauto\.h|win(?:base|def|error|gdi|nls|nt|user)\.h)$/ &&
 			   $file_dir !~ /tests$/)
 			{
 			    $output->write("$file: #include \<$header\> is a local include\n");
diff --git a/tools/winapi_check/winapi_function.pm b/tools/winapi_check/winapi_function.pm
index 6b4065e..688651a 100644
--- a/tools/winapi_check/winapi_function.pm
+++ b/tools/winapi_check/winapi_function.pm
@@ -304,15 +304,15 @@
     }
 
     local $_ = $self->calling_convention;
-    if(/^__cdecl$/) {
+    if($_ eq "__cdecl") {
 	return "cdecl";
-    } elsif(/^VFWAPIV|WINAPIV$/) {
+    } elsif(/^(?:VFWAPIV|WINAPIV)$/) {
 	if(!defined($suffix)) { return undef; }
 	return "pascal$suffix"; # FIXME: Is this correct?
-    } elsif(/^__stdcall|VFWAPI|WINAPI|CALLBACK$/) {
+    } elsif(/^(?:__stdcall|VFWAPI|WINAPI|CALLBACK)$/) {
 	if(!defined($suffix)) { return undef; }
 	return "pascal$suffix";
-    } elsif(/^__asm$/) {
+    } elsif($_ eq "__asm") {
 	return "asm";
     } else {
 	return "cdecl";
@@ -323,13 +323,13 @@
     my $self = shift;
 
     local $_ = $self->calling_convention;
-    if(/^__cdecl$/) {
+    if($_ eq "__cdecl") {
 	return "cdecl";
-    } elsif(/^VFWAPIV|WINAPIV$/) {
+    } elsif(/^(?:VFWAPIV|WINAPIV)$/) {
 	return "varargs";
-    } elsif(/^__stdcall|VFWAPI|WINAPI|CALLBACK$/) {
+    } elsif(/^(?:__stdcall|VFWAPI|WINAPI|CALLBACK)$/) {
 	return "stdcall";
-    } elsif(/^__asm$/) {
+    } elsif($_ eq "__asm") {
 	return "asm";
     } else {
 	return "cdecl";
diff --git a/tools/winapi_check/winapi_local.pm b/tools/winapi_check/winapi_local.pm
index a30c7c6..aa83bf3 100644
--- a/tools/winapi_check/winapi_local.pm
+++ b/tools/winapi_check/winapi_local.pm
@@ -108,39 +108,39 @@
     }
 
     my $segmented = 0;
-    if(defined($implemented_return_kind) && $implemented_return_kind =~ /^segptr|segstr$/) {
+    if(defined($implemented_return_kind) && $implemented_return_kind =~ /^seg[sp]tr$/) {
 	$segmented = 1;
     }
 
     my $implemented_calling_convention;
     if($winapi->name eq "win16") {
-	if($calling_convention =~ /^__cdecl$/) {
+	if($calling_convention eq "__cdecl") {
 	    $implemented_calling_convention = "cdecl";
-	} elsif($calling_convention =~ /^VFWAPIV|WINAPIV$/) {
+	} elsif($calling_convention =~ /^(?:VFWAPIV|WINAPIV)$/) {
 	    $implemented_calling_convention = "varargs";
-	} elsif($calling_convention =~ /^__stdcall|VFWAPI|WINAPI|CALLBACK$/) {
-	    if(defined($implemented_return_kind) && $implemented_return_kind =~ /^s_word|word|void$/) {
+	} elsif($calling_convention =~ /^(?:__stdcall|VFWAPI|WINAPI|CALLBACK)$/) {
+	    if(defined($implemented_return_kind) && $implemented_return_kind =~ /^(?:s_word|word|void)$/) {
 		$implemented_calling_convention = "pascal16";
 	    } else {
 		$implemented_calling_convention = "pascal";
 	    }
-	} elsif($calling_convention =~ /^__asm$/) {
+	} elsif($calling_convention eq "__asm") {
     	    $implemented_calling_convention = "asm";
 	} else {
     	    $implemented_calling_convention = "cdecl";
 	}
     } elsif($winapi->name eq "win32") {
-	if($calling_convention =~ /^__cdecl$/) {
+	if($calling_convention eq "__cdecl") {
 	    $implemented_calling_convention = "cdecl";
-	} elsif($calling_convention =~ /^VFWAPIV|WINAPIV$/) {
+	} elsif($calling_convention =~ /^(?:VFWAPIV|WINAPIV)$/) {
 	    $implemented_calling_convention = "varargs";
-	} elsif($calling_convention =~ /^__stdcall|VFWAPI|WINAPI|CALLBACK$/) {
-	    if(defined($implemented_return_kind) && $implemented_return_kind =~ /^longlong$/) {
+	} elsif($calling_convention =~ /^(?:__stdcall|VFWAPI|WINAPI|CALLBACK)$/) {
+	    if(defined($implemented_return_kind) && $implemented_return_kind eq "longlong") {
 		$implemented_calling_convention = "stdcall"; # FIXME: Check entry flags
 	    } else {
 		$implemented_calling_convention = "stdcall";
 	    }
-	} elsif($calling_convention =~ /^__asm$/) {
+	} elsif($calling_convention eq "__asm") {
     	    $implemented_calling_convention = "asm";
 	} else {
 	    $implemented_calling_convention = "cdecl";
@@ -166,7 +166,7 @@
     elsif($implemented_calling_convention ne $declared_calling_convention &&
        $implemented_calling_convention ne "asm" &&
        !($declared_calling_convention =~ /^pascal/ && $forbidden_return_type) &&
-       !($implemented_calling_convention =~ /^cdecl|varargs$/ && $declared_calling_convention =~ /^cdecl|varargs$/))
+       !($implemented_calling_convention =~ /^(?:cdecl|varargs)$/ && $declared_calling_convention =~ /^(?:cdecl|varargs)$/))
     {
 	if($options->calling_convention && (
             ($options->calling_convention_win16 && $winapi->name eq "win16") ||
@@ -203,7 +203,7 @@
 	$#argument_types--;
     }
 
-    if($internal_name =~ /^NTDLL__ftol|NTDLL__CIpow$/) { # FIXME: Kludge
+    if($internal_name =~ /^(?:NTDLL__ftol|NTDLL__CIpow)$/) { # FIXME: Kludge
 	# ignore
     } else {
 	my $n = 0;
@@ -230,7 +230,7 @@
 	    if(defined($kind) && $kind eq "struct16") {
 		$n+=4;
 		("long", "long", "long", "long");
-	    } elsif(defined($kind) && $kind =~ /^(?:longlong)$/) {
+	    } elsif(defined($kind) && $kind eq "longlong") {
 		$n+=2;
 		("long", "long");
 	    } else {
@@ -246,8 +246,8 @@
 	for my $n (0..$#argument_kinds) {
 	    if(!defined($argument_kinds[$n]) || !defined($declared_argument_kinds[$n])) { next; }
 
-	    if($argument_kinds[$n] =~ /^segptr|segstr$/ ||
-	       $declared_argument_kinds[$n] =~ /^segptr|segstr$/)
+	    if($argument_kinds[$n] =~ /^seg[ps]tr$/ ||
+	       $declared_argument_kinds[$n] =~ /^seg[ps]tr$/)
 	    {
 		$segmented = 1;
 	    }
@@ -334,10 +334,10 @@
 	    my $called_name = $1;
 	    my $channel = $2;
 	    my $called_arguments = $3;
-	    if($called_name =~ /^if|for|while|switch|sizeof$/) {
+	    if($called_name =~ /^(?:if|for|while|switch|sizeof)$/) {
 		# Nothing
-	    } elsif($called_name =~ /^ERR|FIXME|MSG|TRACE|WARN$/) {
-		if($first_debug_message && $called_name =~ /^FIXME|TRACE$/) {
+	    } elsif($called_name =~ /^(?:ERR|FIXME|MSG|TRACE|WARN)$/) {
+		if($first_debug_message && $called_name =~ /^(?:FIXME|TRACE)$/) {
 		    $first_debug_message = 0;
 		    if($called_arguments =~ /^\"\((.*?)\)(.*?)\"\s*,\s*(.*?)$/) {
 			my $formating = $1;