markup-validator commit: Avoid unnecessary grouping regexp parenthesis.

changeset:   3260:6f07109561fe
user:        Ville Skyttä <ville.skytta@iki.fi>
date:        Mon Nov 28 21:02:01 2011 +0200
files:       httpd/cgi-bin/check
description:
Avoid unnecessary grouping regexp parenthesis.


diff -r c4877c0019a0 -r 6f07109561fe httpd/cgi-bin/check
--- a/httpd/cgi-bin/check	Thu Nov 17 00:27:52 2011 +0200
+++ b/httpd/cgi-bin/check	Mon Nov 28 21:02:01 2011 +0200
@@ -446,7 +446,7 @@
 if ($File->{Charset}->{HTTP}) {    # HTTP, if given, is authoritative.
     $File->{Charset}->{Use} = $File->{Charset}->{HTTP};
 }
-elsif ($File->{ContentType} =~ m(^text/([-.a-zA-Z0-9]\+)?xml$)) {
+elsif ($File->{ContentType} =~ m(^text/(?:[-.a-zA-Z0-9]\+)?xml$)) {
 
     # Act as if $http_charset was 'us-ascii'. (MIME rules)
     $File->{Charset}->{Use} = 'us-ascii';
@@ -469,7 +469,7 @@
 {
     $File->{Charset}->{Use} = 'utf-16';
 }
-elsif ($File->{ContentType} =~ m(^application/([-.a-zA-Z0-9]+\+)?xml$)) {
+elsif ($File->{ContentType} =~ m(^application/(?:[-.a-zA-Z0-9]+\+)?xml$)) {
     $File->{Charset}->{Use} = "utf-8";
 }
 elsif (&is_xml($File) and not $File->{ContentType} =~ m(^text/)) {
@@ -586,7 +586,7 @@
 #
 # Override DOCTYPE if user asked for it.
 if ($File->{Opt}->{DOCTYPE}) {
-    if ($File->{Opt}->{DOCTYPE} !~ /(Inline|detect)/i) {
+    if ($File->{Opt}->{DOCTYPE} !~ /(?:Inline|detect)/i) {
         $File = &override_doctype($File);
     }
     else {
@@ -3326,7 +3326,7 @@
 
     # Others
     if ($q->param('doctype') and
-        not $q->param('doctype') =~ /(Inline|detect)/i)
+        not $q->param('doctype') =~ /(?:Inline|detect)/i)
     {
         $thispage .= 'doctype=' . uri_escape($q->param('doctype')) . ';';
     }
@@ -3579,7 +3579,7 @@
     #  }
 
     # No or unknown FPI and a relative SI.
-    if ($err->{msg} =~ m(cannot (open|find))) {
+    if ($err->{msg} =~ m(cannot (?:open|find))) {
         $File->{'Error Flagged'} = TRUE;
         my $tmpl = &W3C::Validator::MarkupValidator::get_error_template($File);
         $tmpl->param(fatal_parse_extid_error => TRUE);

Received on Monday, 28 November 2011 19:50:26 UTC