From: zzapper <david@tvis.co.uk>
To: zsh-users@zsh.org
Subject: Re: Regular expressions in zsh
Date: Thu, 24 Feb 2011 10:28:19 +0000 (UTC) [thread overview]
Message-ID: <Xns9E966A8313684zzappergmailcom@80.91.229.10> (raw)
In-Reply-To: <Xns9E95A9D1688C0zzappergmailcom@80.91.229.10>
zzapper wrote in news:Xns9E95A9D1688C0zzappergmailcom@80.91.229.10:
> Phil Pennock wrote in news:20110219054807.GA57597@redoubt.spodhuis.org:
>
>
>>
>> zsh has had -pcre-match for a very long time; it's only the =~ operator
>> which is newish; note that if you're a Perl fan, then you might:
>>
with a little help from zsh-lovers webpage
zmodload zsh/pcre
setopt REMATCH_PCRE
var=ddddd; [[ "$var" =~ ^d+$ ]] && echo matched || echo did not match
var=dddee; regexp="^e+$"; [[ "$var" =~ $regexp ]] && echo $regexp matched
$var || echo $regexp did not match $var
# above should be on one line
--
zzapper
http://zzapper.co.uk/ Technical Tips
next prev parent reply other threads:[~2011-02-24 10:28 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-19 3:38 Vincent Stemen
2011-02-19 5:48 ` Phil Pennock
2011-02-23 16:41 ` zzapper
2011-02-24 10:28 ` zzapper [this message]
2011-02-24 11:21 ` Phil Pennock
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Xns9E966A8313684zzappergmailcom@80.91.229.10 \
--to=david@tvis.co.uk \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).