[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: When to escape magic characters
- From: Nagaev Boris <bnagaev@...>
- Date: Sat, 18 Jul 2015 22:41:24 +0300
On Sat, Jul 18, 2015 at 10:33 PM, Dirk Laurie <dirk.laurie@gmail.com> wrote:
> I thought one always needed to escape for example *.
> I was wrong.
>
> $ lua
> Lua 5.3.1 Copyright (C) 1994-2015 Lua.org, PUC-Rio
>> ("ab*c"):match"ab*"
> ab
>> ("ab*c"):match"ab?*"
> ab*
>
It complies with the manual:
> A pattern item can be
> [...]
> a single character class followed by '*', [...]
b? is not a single character class, that is why * does not act like a
magic character.
--
Best regards,
Boris Nagaev