zsh-workers
 help / color / mirror / code / Atom feed
From: Stephane Chazelas <stephane.chazelas@gmail.com>
To: Phil Pennock <zsh-workers+phil.pennock@spodhuis.org>,
	Bart Schaefer <schaefer@brasslantern.com>,
	zsh-workers@zsh.org
Subject: Re: please consider using PCRE_DOLLAR_ENDONLY (and PCRE_DOTALL) for rematchpcre
Date: Tue, 23 Jan 2018 13:55:25 +0000	[thread overview]
Message-ID: <20180123135525.GA31348@chaz.gmail.com> (raw)
In-Reply-To: <20180123065735.GA16678@chaz.gmail.com>

2018-01-23 06:57:35 +0000, Stephane Chazelas:
[...]
> It's more about single-line where the line delimiter happens to
> be included (and you want the $ to match on the end of that line
> as opposed to the end of the string).
[...]

I've been trying to imagine a use case that could be broken by
the change (of adding PCRE_DOLLAR_ENDONLY).

One case could be with $mapfile[file] (which does expand to the
full content of the file) for text files with a single line, like

set -o rematchpcre
zmodload zsh/mapfile
[[ $mapfile[/etc/debian_version] =~ '/sid$' ]]

Which would have to be changed to:

[[ $mapfile[/etc/debian_version] =~ '/sid\n?$' ]]

or

[[ $mapfile[/etc/debian_version] =~ '/(?m)sid$' ]]

though personally, I'd rather do:

[[ $(</etc/debian_version) = */sid ]]

Or 

grep -q '/sid$' /etc/debian_version

Can anyone think of less far-fetched ones?

-- 
Stephane


      reply	other threads:[~2018-01-23 13:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-22 12:25 Stephane Chazelas
2017-11-22 21:40 ` Stephane Chazelas
2018-01-20  7:48   ` Bart Schaefer
2018-01-22  5:28     ` Phil Pennock
2018-01-23  6:57       ` Stephane Chazelas
2018-01-23 13:55         ` Stephane Chazelas [this message]

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=20180123135525.GA31348@chaz.gmail.com \
    --to=stephane.chazelas@gmail.com \
    --cc=schaefer@brasslantern.com \
    --cc=zsh-workers+phil.pennock@spodhuis.org \
    --cc=zsh-workers@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).