|
|
| Welcome to the Monastery | |
| PerlMonks |
Re: Re: Regular Expressions: Call for Examplesby converter (Priest) |
| on Jul 22, 2002 at 08:39 UTC ( #183977=note: print w/ replies, xml ) | Need Help?? |
|
Since I'm not yet the regex master I aspire to be, I can't authoritatively state that this solution is better, but it seems to work. If you're working with ordered item labels you can make your assertion more specific:
The first iteration matches "2)" and replaces it with "\n2)", the second "3)", and so on. Update: I should know better than to post when I'm tired. Someone just pointed out to me that it would be much neater to do:
Thanks, Aristotle, you're right. The while loop substitution isn't equivalent because it will make replacements in any order (at any position in the string) while the original substitution I posted will not.
In Section
Meditations
|
|
||||||||||||||||||||||