zsh-workers
 help / color / mirror / code / Atom feed
* Shouldn't be IDENT more smart?
@ 2023-02-10  9:42 Sebastian Gniazdowski
  2023-02-10 11:12 ` Stephane Chazelas
  0 siblings, 1 reply; 2+ messages in thread
From: Sebastian Gniazdowski @ 2023-02-10  9:42 UTC (permalink / raw)
  To: Zsh hackers list

[-- Attachment #1: Type: text/plain, Size: 289 bytes --]

[[ 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?

-- 
Best regards,
Sebastian Gniazdowski

[-- Attachment #2: Type: text/html, Size: 1217 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Shouldn't be IDENT more smart?
  2023-02-10  9:42 Shouldn't be IDENT more smart? Sebastian Gniazdowski
@ 2023-02-10 11:12 ` Stephane Chazelas
  0 siblings, 0 replies; 2+ messages in thread
From: Stephane Chazelas @ 2023-02-10 11:12 UTC (permalink / raw)
  To: Sebastian Gniazdowski; +Cc: Zsh hackers list

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-02-10 11:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-10  9:42 Shouldn't be IDENT more smart? Sebastian Gniazdowski
2023-02-10 11:12 ` Stephane Chazelas

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).