[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: string.gsub - possible enhancement
- From: Mark Edgar <medgar@...>
- Date: Wed, 05 Apr 2006 15:30:28 -0700
Shmuel Zeigerman wrote:
Mark Edgar wrote:
For an arbitrarily complicated pattern, this function will do what you
want:
[snip]
Thanks for the excellent code which I intend to make use of. Your
solution is in fact more generic than that I was proposing. But still,
it'd be nice to have this functionality "out of the box".
Yet another thing that I miss in string.gsub is the ability to break the
process after arbitrary match (when the `repl' function returns some
dedicated value that means "no further replaces are needed").
To solve this, you could write a loop based on string.find, making use
of its first two return values and its third parameter to find each
match in turn.
-Mark