Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: =~ regex match
- X-seq: zsh-workers 23330
- From: Peter Stephenson <pws@xxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: Re: PATCH: =~ regex match
- Date: Thu, 26 Apr 2007 10:31:02 +0100
- In-reply-to: <20070426041938.GA44533@xxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <20070426041938.GA44533@xxxxxxxxxxxxxxxxxxxx>
Phil Pennock wrote:
> My mental processes push me towards regexps perhaps more than is
> healthy. zsh/pcre's -pcre-match conditional operator is firmly in my
> toolkit.
>
> Earlier today I discovered that bash has a =~ operator for doing
> extended regexp comparisons. I became envious, so I did something about
> it. Which didn't involve giving up all the conveniences of zsh which
> have spoiled me.
>
> The below patch makes =~ an operator which silently auto-loads zsh/pcre
> and uses -pcre-match from there. This is not bash-compatible in that:
>
> 1: it's PCRE -- far more to my liking :^)
> 2: if the regexp pattern is bad, it returns false/1 not false/2.
I thought about =~ and it seemed to me that since it would be largely
there for bash compatibility it would be better to do it with the system
regexp library, which would be more compatible and wouldn't depend on
optional packages. It shouldn't be too hard to do. We probably
wouldn't support BASH_REMATCH, however.
--
Peter Stephenson <pws@xxxxxxx> Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070
To access the latest news from CSR copy this link into a web browser: http://www.csr.com/email_sig.php
To get further information regarding CSR, please visit our Investor Relations page at http://ir.csr.com/csr/about/overview
Messages sorted by:
Reverse Date,
Date,
Thread,
Author