C:\>perl -MYAPE::Regex::Explain -e "print YAPE::Regex::Explain->new( '^[a-z]{3,10}\s*(?:\w{3,7}?\:\/\/[\w\-\.\/]*)??\/[\w\-\.\/~%@&=+$,;]*(?:\?[\S]*)??\s*http\/\d\.\d$')->explain"
The regular expression:
(?-imsx:^[a-z]{3,10}\s*(?:\w{3,7}?\:\/\/[\w\-\.\/]*)??\/[\w\-\.\/~%@&=+$,;]*(?:\?[\S]*)??\s*http\/\d\.\d$)
matches as follows:
NODE EXPLANATION
----------------------------------------------------------------------
(?-imsx: group, but do not capture (case-sensitive)
(with ^ and $ matching normally) (with . not
matching \n) (matching whitespace and #
normally):
----------------------------------------------------------------------
^ the beginning of the string
----------------------------------------------------------------------
[a-z]{3,10} any character of: 'a' to 'z' (between 3
and 10 times (matching the most amount
possible))
----------------------------------------------------------------------
\s* whitespace (\n, \r, \t, \f, and " ") (0 or
more times (matching the most amount
possible))
----------------------------------------------------------------------
(?: group, but do not capture (optional
(matching the least amount possible)):
----------------------------------------------------------------------
\w{3,7}? word characters (a-z, A-Z, 0-9, _)
(between 3 and 7 times (matching the
least amount possible))
----------------------------------------------------------------------
\: ':'
----------------------------------------------------------------------
\/ '/'
----------------------------------------------------------------------
\/ '/'
----------------------------------------------------------------------
[\w\-\.\/]* any character of: word characters (a-z,
A-Z, 0-9, _), '\-', '\.', '\/' (0 or
more times (matching the most amount
possible))
----------------------------------------------------------------------
)?? end of grouping
----------------------------------------------------------------------
\/ '/'
----------------------------------------------------------------------
[\w\-\.\/~%@&=+$,;]* any character of: word characters (a-z, A-
Z, 0-9, _), '\-', '\.', '\/', '~', '%',
'@', '&', '=', '+', '$', ',', ';' (0 or
more times (matching the most amount
possible))
----------------------------------------------------------------------
(?: group, but do not capture (optional
(matching the least amount possible)):
----------------------------------------------------------------------
\? '?'
----------------------------------------------------------------------
[\S]* any character of: non-whitespace (all
but \n, \r, \t, \f, and " ") (0 or more
times (matching the most amount
possible))
----------------------------------------------------------------------
)?? end of grouping
----------------------------------------------------------------------
\s* whitespace (\n, \r, \t, \f, and " ") (0 or
more times (matching the most amount
possible))
----------------------------------------------------------------------
http 'http'
----------------------------------------------------------------------
\/ '/'
----------------------------------------------------------------------
\d digits (0-9)
----------------------------------------------------------------------
\. '.'
----------------------------------------------------------------------
\d digits (0-9)
----------------------------------------------------------------------
$ before an optional \n, and the end of the
string
----------------------------------------------------------------------
) end of grouping
----------------------------------------------------------------------