Git development
 help / color / mirror / Atom feed
From: "Björn Steinbrink" <B.Steinbrink@gmx.de>
To: Eric Wong <normalperson@yhbt.net>
Cc: Junio C Hamano <gitster@pobox.com>,
	Dennis Schridde <devurandom@gmx.net>,
	git@vger.kernel.org
Subject: Re: [PATCH] git-svn: handle leading/trailing whitespace from svnsync revprops
Date: Sat, 12 Jan 2008 10:55:05 +0100	[thread overview]
Message-ID: <20080112095505.GA5681@atjola.homenet> (raw)
In-Reply-To: <20080112091242.GA27109@soma>

On 2008.01.12 01:12:42 -0800, Eric Wong wrote:
> Junio C Hamano <gitster@pobox.com> wrote:
> > Is it only me who finds that
> > 
> > 	($var) = ($var =~ m{^(any regexp)$}) or die "message"
> > 
> > is extremely a roundabout and hard-to-read way to say:
> > 
> > 	if ($var !~ m{^(the same regexp)$} {
> >         	die "message";
> > 	}
> > 
> > which is much easier to read?
> 
> The statements are not equivalent, however.  I'd have to add
> 
> 	$var = $1;
> 
> too, because I needed to extract what was inside the ( ) since the '$'
> doesn't catch the trailing newline, either.  I also couldn't find any of
> the /sm, /m, /s switches useful for making '$' not accept the trailing
> newline, either.

The \z assertion will do, eg m/^foo\z/ will only match exactly "foo",
not "foo\n". As it is a zero-width assertion, you can also write
m/^foo\z$/ if you prefer that.

Björn

  reply	other threads:[~2008-01-12  9:55 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-08 16:38 Odd number of elements in anonymous hash Dennis Schridde
2008-01-08 17:21 ` Junio C Hamano
2008-01-08 17:30   ` Dennis Schridde
2008-01-10  8:38     ` Eric Wong
2008-01-10 11:04       ` Dennis Schridde
2008-01-10 17:13         ` Dennis Schridde
2008-01-10 20:08           ` Junio C Hamano
2008-01-10 21:13             ` Dennis Schridde
2008-01-10 21:45               ` Junio C Hamano
2008-01-12  7:13                 ` [PATCH] git-svn: handle leading/trailing whitespace from svnsync revprops Eric Wong
2008-01-12  7:57                   ` Junio C Hamano
2008-01-12  9:12                     ` Eric Wong
2008-01-12  9:55                       ` Björn Steinbrink [this message]
2008-01-12 18:57                       ` Junio C Hamano
2008-01-12 19:31                         ` Junio C Hamano
2008-01-12 12:34                   ` Dennis Schridde
2008-01-09 22:58   ` Odd number of elements in anonymous hash Eric Wong
     [not found] ` <200801240037.33908.devurandom@gmx.net>
     [not found]   ` <4797E894.8060706@vilain.net>
     [not found]     ` <200801241513.45088.devurandom@gmx.net>
2008-01-24 23:10       ` Sam Vilain

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=20080112095505.GA5681@atjola.homenet \
    --to=b.steinbrink@gmx.de \
    --cc=devurandom@gmx.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=normalperson@yhbt.net \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox