Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Shouldn't be IDENT more smart?
- X-seq: zsh-workers 51393
- From: Stephane Chazelas <stephane@xxxxxxxxxxxx>
- To: Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx>
- Cc: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Re: Shouldn't be IDENT more smart?
- Date: Fri, 10 Feb 2023 11:12:26 +0000
- Archived-at: <https://zsh.org/workers/51393>
- In-reply-to: <CAKc7PVDK4-EVL3YBfQop7iX_n01yuJR2=bgkFnUE=ptagi++tQ@mail.gmail.com>
- List-id: <zsh-workers.zsh.org>
- Mail-followup-to: Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx>, Zsh hackers list <zsh-workers@xxxxxxx>
- References: <CAKc7PVDK4-EVL3YBfQop7iX_n01yuJR2=bgkFnUE=ptagi++tQ@mail.gmail.com>
2023-02-10 09:42:47 +0000, Sebastian Gniazdowski:
> [[ 0 == [[:IDENT:]]## ]]; print $?
> 0
>
> That's fine. However, it also accepts 0[a-z]:
>
> [[ 0q == [[:IDENT:]]## ]]; print $?
> 0
>
> Shouldn't it be defined something like:
>
> (<->|[A-Za-z_][A-Za-z0-9_]#)? So that it accepts $0, and also var0? but not
> 0var?
[...]
No, [:IDENT:] that you can use inside [...] is just another
character class, it can only match a single character.
Remember you can do things like `[[:IDENT:],.+[:blank:]] for
instance to match on a character that either
- classified as IDENT
- clsasified as blank
- ,
- .
- +
--
Stephane
Messages sorted by:
Reverse Date,
Date,
Thread,
Author