develooper Front page | perl.perl5.porters | Postings from August 2010

Re: RFC: New regex modifier flags

Thread Previous | Thread Next
From:
H.Merijn Brand
Date:
August 4, 2010 04:57
Subject:
Re: RFC: New regex modifier flags
Message ID:
20100804135740.408cf3d1@pc09.procura.nl
On Wed, 4 Aug 2010 09:56:18 +0100, Paul LeoNerd Evans
<leonerd@leonerd.org.uk> wrote:

> On Wed, Aug 04, 2010 at 09:12:31AM +0200, H.Merijn Brand wrote:
> > 7) use a currently unsupported syntax with non-ascii characters that
> >    has no conflicts:  
> 
> (I suspect you meant "non-letter" rather than "non-ascii" :) )

Well, since Unicode characters are hard to enter in many editors,
choosing weird marks like ⊝ (CIRCLED DASH), ⌥ (OPTION KEY), ⚐ (WHITE
FLAG) or ⚑ (BLACK FLAG) would be less useful (but fun).

Other than that, yes, you're right, when restricting letter to ASCII
letters. (/me sees Ŀ and ł as letters too, but these are probably also
hard to enter and use for regex flags - ł might mean "do not use locale")

> >    $a =~ m{pattern}msi_Cu_x
> > 
> > $ perl -we'$a =~ m{foo}msi_'
> > Bareword found where operator expected at -e line 1, near "m{foo}msi_"
> > syntax error at -e line 1, next token ???
> > Execution of -e aborted due to compilation errors.  
> 
> That actually has a certain neatness to it; it's similar to the use of
> "--" for GNU-style long options, given as previously all getopt-style
> options were -[letter], or -- on its own to indicate the end.

Going down that line would mean that

   $a =~ m{pattern}msi_Cu_x

is equivalent to

   $a =~ m{pattern}msxi_Cu

The more I see it, the more I like it :)

-- 
H.Merijn Brand  http://tux.nl      Perl Monger  http://amsterdam.pm.org/
using 5.00307 through 5.12 and porting perl5.13.x on HP-UX 10.20, 11.00,
11.11, 11.23, and 11.31, OpenSuSE 10.3, 11.0, and 11.1, AIX 5.2 and 5.3.
http://mirrors.develooper.com/hpux/           http://www.test-smoke.org/
http://qa.perl.org      http://www.goldmark.org/jeff/stupid-disclaimers/

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