[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]

[perl #54702] Feature: regexp modifier to disable interpolation like m''



On Fri May 23 03:01:21 2008, eda@waniasset.com wrote:
>
> Normally in m// and s/// the pattern is double-quote interpolated.
> You can avoid this by choosing '' as the delimiter.  But that's not
> always very readable (PBP for example recommends using only // and {}
> as delimiters).  And of course the pattern might contain ' 
characters.
> 
> As an alternative to m'', how about a pattern modifier /n to suppress
> interpolation?
> 
> Old style: $string =~ m'Pattern with a literal $ sign';
> 
> Proposed new style: $string =~ /Pattern with a literal $ sign/n;
> 
> where the /n modifier turns off interpolation.
 
I don't really like the idea of adding a modifier to supress 
interpolation...

Currently there is:
  $string =~ m/Pattern with a literal \$ sign/;  and
  $string =~ m'Pattern with a literal \$ sign';

Personally, I have never ever used m'' and I don't see a reason to use /
n over \. 

A reason against it:
You need to look at the end of the regex to know wheter or not things 
get interolated. What if the regex is using the /x modifiers and takes 
10 lines?

Also according to:
http://www.regular-expressions.info/refflavors.html  JGSoft and .NET 
are already using the  n  modifier for an explicit capture which can 
make it very confusing (for people coming from JGSoft and/or .NET) and/
or for regex tools.


Kind regards,

Bram


Follow-Ups from:
Abigail <abigail@abigail.be>

[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]