Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^3: how to measure strictness of a regex ?

by tobyink (Abbot)
on Jan 23, 2013 at 07:47 UTC ( #1014853=note: print w/replies, xml ) Need Help??


in reply to Re^2: how to measure strictness of a regex ?
in thread how to measure strictness of a regex ?

I think my original code when I was testing was something along the lines of:

print re_strictness qr/.../, "\n";

In which case the ($) prototype helps Perl see the "\n" as a parameter for print, not for re_strictness.

By the way, it's worth pointing out that qr/^Dad+y$/ is also considered slightly stricter than qr/Dad+y/.

use 5.014; use strict; use warnings; use re (); use List::Util 'sum'; sub re_strictness ($) { sum map length, re::regmust shift } print re_strictness qr/^Dad+y$/, "\n", re_strictness qr/Dad+y/, "\n", re_strictness qr/D.+/, "\n", ;
package Cow { use Moo; has name => (is => 'lazy', default => sub { 'Mooington' }) } say Cow->new->name

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1014853]
help
Chatterbox?
Discipulus without Corion and with choroba in another timezone the monastery was silent.. I was silbing alone in the cloister
[choroba]: Yes, I feel alone in the cyberspace...
[choroba]: Not many occasions to talk to my wife, either :-(
Discipulus s/silbing/whistle/ dunno from where this word was in my mind..
[Discipulus]: lost in time in space and in the meaning (rocky horror picture show)
[Corion]: Discipulus: Yeah, a short vacation on the Canary islands (Lanzarote). Always great to be in the warmth and sun, from a cold and rainy February here ;)
[Corion]: choroba: Yeah, you have to find a time for the regular skype (or whatever) meetup, I imagine that's hard

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (6)
As of 2017-02-22 08:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?






    Results (325 votes). Check out past polls.