lua-users home
lua-l archive

Re: string.gsub pattern question

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


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

AltStyle によって変換されたページ (->オリジナル) /