develooper Front page | perl.perl5.porters | Postings from October 2009

Re: What should \s \w \d match in 5.12?

Thread Previous | Thread Next
From:
Abigail
Date:
October 5, 2009 03:12
Subject:
Re: What should \s \w \d match in 5.12?
Message ID:
20091005101217.GA7980@almanda
On Mon, Oct 05, 2009 at 05:11:16AM +0200, Aristotle Pagaltzis wrote:
> * Eric Brine <ikegami@adaelis.com> [2009-10-05 01:30]:
> > I noticed you didn't touch \s, which is the one that troubles
> > me (too?). I often use \d and \w in patterns that are captured.
> > It's good to match tightly, so I agree with you. \s, on the
> > other hand, matches parts of the input I usually wish to
> > discard. Having it behave laxly (i.e. match characters such as
> > NBSP) would benefit me.
> 
> That’s a sore point for me. Even the fact that \s matches newline
> often annoys me. I wish there was a shorthand for [ \t] which is
> what I usually want when I use \s – though I often use \s anyway
> for the brevity when it’s not a huge issue.


It seems you want to match horizontal whitespace. I use \h when I need
that, that will match space, tab, the no-break space, and a handful of
Unicode spaces.


Abigail

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About