Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re: Regex MATCH

by Utilitarian (Vicar)
on Sep 14, 2012 at 08:14 UTC ( #993669=note: print w/replies, xml ) Need Help??

in reply to Regex MATCH

With the tags you provide, wouldn't something like the following be more discerning?
Utilitarian@busybox ~$cat tmp/ #!/usr/bin/perl use strict; use warnings; my $prefix='DOC_'; for (<DATA>){ chomp(my $line=$_); print "$line\n" if ($line =~ /^$prefix[0-9]{3}(_|-)[0-9]{3}$/); } __DATA__ DOC_001_123 DOC_002_214 DOC_001-548 DOC_001-987 Utilitarian@busybox ~$perl tmp/ DOC_001_123 DOC_002_214 DOC_001-548

bart below is correct, to constrain the matches to hyphens the regex above should have read /^$prefix[0-9]{3}-[0-9]{3}$/

print "Good ",qw(night morning afternoon evening)[(localtime)[2]/6]," fellow monks."

Replies are listed 'Best First'.
Re^2: Regex MATCH
by bart (Canon) on Sep 14, 2012 at 10:45 UTC
    You've got it backwards. His regex matches, but he doesn't want it to match.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://993669]
[Corion]: Oh yay. The (external, not guided by me) programmers have chosen Moose+DBIx::Class for some implementation, and now seem to do 1+n SELECT statements for each row, as is usual when using ORMs.
[Corion]: So maybe I should investigate how to plug in a cache in front of DBIx::Class so I can do a ->selectall_hashre f and then satisfy the "sub"-selects from that cached single SELECT statement ...
[erix]: then you might as well send that patch to the DBIC guys :)

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (7)
As of 2017-09-25 10:59 GMT
Find Nodes?
    Voting Booth?
    During the recent solar eclipse, I:

    Results (279 votes). Check out past polls.