[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: help with string:match
- From: Tom N Harris <telliamed@...>
- Date: Tue, 03 Mar 2015 21:45:46 -0500
On Sunday, March 01, 2015 10:04:30 AM Pablo Botelho wrote:
> s1 = '/foo/:bar/oof/:rab'
>
> s2 = '/foo/lua/oof/rocks'
>
> I would like to produce the following information
>
> 1) If they match (these two above should match)
>
> 2) a table holding the values of 's2' in with the corresponding name in 's1'
> In this case we would have: { bar = "lua", rab = "rocks" }
The template you describe is basically a pattern to match the second string.
Just change each '/:(%w+)' to '/(%%w+)' with gsub. And the same pattern to
extract the names.
--
tom <telliamed@whoopdedo.org>