Re: string.gsub pattern question
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: string.gsub pattern question
- From: Daniel Hertrich <dhertrich@...>
- Date: 2011年9月27日 12:58:27 +0200
Hi all,
thanks fopr your ideas,
On Tue, Sep 27, 2011 at 12:40 PM, Thomas Buergel
<Thomas.Buergel@varian.com> wrote:
>> I don't believe this can be done with a simple pattern replacement.
>> You have to move into using a custom callback function to do the
>> negative look-behind, something like:
>
> Or simpler, do a two-step replacement:
I solved the issue another (even simpler) way, which even solves the
issue of different line break codings on different platforms.
Pity that I didn't think of that before ;-)
nLineLength = string.len(line)
if string.sub(line, nLineLength-3, nLineLength) ~= "<BR>" then
line = line .. "<BR>"
end
But your ideas were necessary to lead me to this solution. So thanks a lot!
Daniel