zsh-workers
 help / color / mirror / code / Atom feed
* Regex not halt caputre second slash
@ 2023-08-14 10:41 Budi
  2023-08-14 12:59 ` Eric Cook
  0 siblings, 1 reply; 4+ messages in thread
From: Budi @ 2023-08-14 10:41 UTC (permalink / raw)
  To: zsh-workers

Zsh pcre (=~) regex of repeated any char. i.e.  .* capture the first
slash but going on then cease to capture any of the rest string when
meet the second slash characters also not capture it

Please help solve !


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

* Re: Regex not halt caputre second slash
  2023-08-14 10:41 Regex not halt caputre second slash Budi
@ 2023-08-14 12:59 ` Eric Cook
  2023-08-14 23:07   ` Budi
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Cook @ 2023-08-14 12:59 UTC (permalink / raw)
  To: zsh-workers

On 8/14/23 06:41, Budi wrote:
> Zsh pcre (=~) regex of repeated any char. i.e.  .* capture the first
> slash but going on then cease to capture any of the rest string when
> meet the second slash characters also not capture it
>
> Please help solve !
>
Can you provide a reproducible example of what you are attempting to do?
Also [['s =~ operator doesn't conform to PCRE by default, its an ERE expression.


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

* Re: Regex not halt caputre second slash
  2023-08-14 12:59 ` Eric Cook
@ 2023-08-14 23:07   ` Budi
  2023-08-15  0:24     ` Lawrence Velázquez
  0 siblings, 1 reply; 4+ messages in thread
From: Budi @ 2023-08-14 23:07 UTC (permalink / raw)
  To: Eric Cook; +Cc: zsh-workers

OMG

Finally found one of the most subtle trooubles in Zsh:

MUST ENCLOSE ZSH REGEX IN DOUBLE QUOTE PAIR, " "


THANKS

On 8/14/23, Eric Cook <llua@gmx.com> wrote:
> On 8/14/23 06:41, Budi wrote:
>> Zsh pcre (=~) regex of repeated any char. i.e.  .* capture the first
>> slash but going on then cease to capture any of the rest string when
>> meet the second slash characters also not capture it
>>
>> Please help solve !
>>
> Can you provide a reproducible example of what you are attempting to do?
> Also [['s =~ operator doesn't conform to PCRE by default, its an ERE
> expression.
>
>


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

* Re: Regex not halt caputre second slash
  2023-08-14 23:07   ` Budi
@ 2023-08-15  0:24     ` Lawrence Velázquez
  0 siblings, 0 replies; 4+ messages in thread
From: Lawrence Velázquez @ 2023-08-15  0:24 UTC (permalink / raw)
  To: Budi, Eric Cook; +Cc: zsh-workers

On Mon, Aug 14, 2023, at 7:07 PM, Budi wrote:
> OMG
>
> Finally found one of the most subtle trooubles in Zsh:
>
> MUST ENCLOSE ZSH REGEX IN DOUBLE QUOTE PAIR, " "

Demonstrably untrue, in general.

	% var=/a/b/c/d/
	% [[ $var =~ .* ]] && typeset -p MATCH
	typeset MATCH=/a/b/c/d/
	% setopt RE_MATCH_PCRE
	% [[ $var =~ .* ]] && typeset -p MATCH
	typeset MATCH=/a/b/c/d/

-- 
vq


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

end of thread, other threads:[~2023-08-15  0:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-14 10:41 Regex not halt caputre second slash Budi
2023-08-14 12:59 ` Eric Cook
2023-08-14 23:07   ` Budi
2023-08-15  0:24     ` Lawrence Velázquez

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).