lua-users home
lua-l archive

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


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