What sort of return are you expecting? You should also check out the split command, it may be more appropriate here than a regex.

I "know" why you are not getting all the matches, and only the penultimate character block, but I can't seem to explain it right and don't want to misspeak. Hopefully someone else will properly explain that.

You regex can be improved as well
You can use \d instead of [0-9]
You have the / listed twice in your set.
There is no need for a set because your pattern is number followed by slash followed by space.
The reason you don't match out to the last item is because the last item does not have the trailing space. Perhaps you want to match space, number, slash instead.
Is it important that you get between 4 and 27 such blocks? What happens if the line has 29 of them? If it is not important then you don't need the {4,27} and can just use +.
Why are you using case-insensitive matching? Is the initial UFOFH possibly in mixed or lower case? If not, then the i is just slowing you down.


In reply to Re: Regex matching by Sifmole
in thread Regex matching by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.