I want to read in a line with a text field, followed
by 4 floats separated by unspecified non-numerics.
I used an RE of the form:
(text);(?:(float)[non-num]){4}
This matches as expected, but I'm only getting 2 substring
matches instead of getting back the 5 desired substrings. $1 is the text field, but $2 is filled with the final float substring with strings 1-3 being tossed. This isn't desirable.
I could duplicate the sub-RE that has the {4} count tag, 4 times, but that seems wasteful and less clear. Is there
a way to preserve my idea matching "4"-sub-RE's while also
returning the 1st 3 matches?
Seems like such a simple concept...sigh. Is this doable
without nibbling at the line in a loop that picks off the
trailing numerics with successive search & replace operations?
TIA
-l
2006-02-18 Retitled by planetscape, as per Monastery guidelines
Original title: 'simple question ?'
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.