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

Re: regexp-replace and ^



2015-10-29 16:46:35 -0700, Bart Schaefer:
> On Oct 29,  7:08pm, Stephane Chazelas wrote:
> }
> } Or maybe have a (E) for ERE and (P) for PCRE parameter expansion flags
> } for the ${var//pattern/replacement}.
> 
> Each of (E) and (P) already means something else.

Indeed. Bummer.

How about some (#E), (#P)? ksh93 has some ~(E:regexp) ~(P:pcre)
and ~(E)regexp, ~(P)pcre.

Probably a lot more complicated.

A pcre_subst builtin addition to the zsh/pcre module would
probably be easy.

Or a zsubst with several options for pattern/ERE/PCRE, case
insensitive...


> It ought to be possible to fix regexp-replace.  A leading "^" isn't that
> difficult, it just means the loop should only go around once (unless you
> expect it to match after embedded newlines).  The tokens that match word
> breaks require more thought.  I'm not sure what to make of lookaheads.

Well, there's also: (foo|^) and variations where you still want
to loop.

-- 
Stephane
> 



Messages sorted by: Reverse Date, Date, Thread, Author