[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: how to gsub on the last occurence ?
- From: Nathan Angelacos <nangel@...>
- Date: Wed, 13 Mar 2013 16:52:48 -0700
On 03/13/2013 04:19 PM, Laurent Faillie wrote:
> Hi all,
>
> how can I substitue that last occurence of a string ?
>
> I would like to do
> string.gsub("blabla/in0_input", "_input", "_alarm")
>
> but I need to ensure the "_input" is really at the end of the string
> (blabla may contains anything :) ).
>
> Thanks
>
> Laurent
>
string.gsub("blabla/in0_input", "_input$", "_alarm")
http://lua-users.org/wiki/PatternsTutorial