I have a single line that is 46 characters long with no delimeters. Looks like:

1222222222222222222223333333333333333333344444

The numbers just show where the data ends and a new set begins. Now I have to parse these, but I've never done it with no delimeters. Also, some fields may be left blank with all spaces. I was trying to use the regex expression:

/([\s.])([\s.]{20})([\s.]{20})([\s.]{5})/;

But it didn't like it. I'm fairly new to Perl, but from what I know this should match ANYTHING (\s for space, . for any other character) and match it for how many spaces are specified. But it sure doesn't work! Any help would be greatly appreciated.

Kevin


In reply to Regex Matching by kbradford

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.