[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: how to gsub on the last occurence ?
- From: Laurent Faillie <l_faillie@...>
- Date: Thu, 14 Mar 2013 01:21:51 +0100
Le 14/03/2013 00:50, Duncan Cross a écrit :
> On Wed, Mar 13, 2013 at 11:19 PM, Laurent Faillie <l_faillie@yahoo.com> wrote:
>> 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
> Well, this will only work if you really do mean "at the end of the
> string", and not just the last occurrence:
>
> string.gsub("blabla/in0_input", "_input$", "_alarm")
>
> The '$' character indicates that this search pattern only matches at
> the end of the string.
Great, it's what I was looking for :)
Thanks