kleinbiker7 has asked for the wisdom of the Perl Monks concerning the following question:
I need some help constructing a regular expression that can accomplish this. I have tried these 2 examples, but they dont work for me:
The text is contained in a string, for example I would like to do this:/(.{0,40}\n){0,4}/ /(?:.{0,40}\n){0,4}/m
Thanks again! Also, please no loops, the goal is to accomplish this with a single regex. If it is not possible, tell me. Cheers!$foo = "1234567890123456789012345678901234567890 1234567890123456789012345678901234567890 1234567890123456789012345678901234567890 1234567890123456789012345678901234567890"; if ($foo =~ m/4 lines of 0 to 40 chars in length/) { do something }
Robert
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How do I match lines of UP TO 40 chars BUT NO MORE in a block of text?
by Zaxo (Archbishop) on Sep 25, 2002 at 20:39 UTC | |
|
Re: How do I match lines of UP TO 40 chars BUT NO MORE in a block of text?
by sauoq (Abbot) on Sep 25, 2002 at 20:26 UTC | |
by kleinbiker7 (Sexton) on Sep 25, 2002 at 21:21 UTC | |
by sauoq (Abbot) on Sep 25, 2002 at 21:33 UTC | |
by Anonymous Monk on Sep 26, 2002 at 01:57 UTC | |
by sauoq (Abbot) on Sep 26, 2002 at 02:11 UTC | |
| |
|
Re: How do I match lines of UP TO 40 chars BUT NO MORE in a block of text?
by BrowserUk (Patriarch) on Sep 25, 2002 at 21:49 UTC |