in reply to Junking excess string.. junk with s///.
First, a link. Read about how regexp's are greedy.
Keeping that in mind, what your first example does is match as much as it can until it finds the last \n. Since you have anchored it to the beginning of your string, it starts at the beginning if your strings, and puts everything until the last \n into $1.
AIUI, the second piece of code does the following:
Update: OK, so I don't quite understand regexp's like I thought I did (and I wasn't even willing to give myself that much credit!) I sit corrected; thanks sauoq. Thank you, drive through.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Junking excess string.. junk with s///.
by sauoq (Abbot) on Oct 16, 2003 at 06:09 UTC | |
|
Re: Re: Junking excess string.. junk with s///.
by SavannahLion (Pilgrim) on Oct 16, 2003 at 06:22 UTC | |
by Yendor (Pilgrim) on Oct 16, 2003 at 06:27 UTC |