[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Preg-match alternative in Lua
- From: Paul K <paulclinger@...>
- Date: Mon, 4 Jun 2012 23:14:18 -0700
Hi Sandeep,
> But After using string.match function, I always need to use string.sub
> function also to extract the required set of values,
You may need to look at captures
(http://lua-users.org/wiki/PatternsTutorial) if I understand correctly
what you want to do.
Paul.
On Mon, Jun 4, 2012 at 10:53 PM, Sandeep Ghai <sandeep.ghai92@gmail.com> wrote:
>>> Hello Everyone,
>>> I just come across the 'preg-match' [1] function of PHP.
>>> Do we have similar function in Lua as well?
>
>> Is there a significant difference between preg-match and string:match? Because if not, then..
>
> Specifically Preg-match is for matching one value or one set of data
> with a given pattern..
> and what I tried with string.match, it matches the pattern and I am
> unable to extract a set of data in the matched pattern.
>
> (There could be my fault too,due to less knowledge about using
> functions, And I am here on this mailing list to learn.)
>
>
>
>> ...Tim's advice from last time you asked was worth following!
>
> No doubt, it worked for me.
> But After using string.match function, I always need to use string.sub
> function also to extract the required set of values,
> But thats the wrong approach ,IMO.
> I just wanted something better to improve my script, Thats why I tried
> to find better functions.
>
> And please be easy on me, I always surf Google before asking anything here.
>
> --
> Sandeep Ghai
> blog: http://sandeepghai.wordpress.com
>