Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Shouldn't be IDENT more smart?



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