I see that you have already received good advice from other monks. I just wanted to mention that item 9 in
Basic debugging checklist shows how to use the
YAPE::Regex::Explain module to demystify regular expressions. For example, you can see an explanation of your regex by running this
perl -MYAPE::Regex::Explain -E 'say YAPE::Regex::Explain->new("(?:ftp:
+\/\/)?\/{5}(a-z_)\/")->explain()'
The output is
The regular expression:
(?-imsx:(?:ftp://)?/{5}(a-z_)/)
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):
----------------------------------------------------------------------
(?: group, but do not capture (optional
(matching the most amount possible)):
----------------------------------------------------------------------
ftp:// 'ftp://'
----------------------------------------------------------------------
)? end of grouping
----------------------------------------------------------------------
/{5} '/' (5 times)
----------------------------------------------------------------------
( group and capture to \1:
----------------------------------------------------------------------
a-z_ 'a-z_'
----------------------------------------------------------------------
) end of \1
----------------------------------------------------------------------
/ '/'
----------------------------------------------------------------------
) end of grouping
----------------------------------------------------------------------