Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Looking for a Regex

by AnomalousMonk (Archbishop)
on Mar 03, 2019 at 21:08 UTC ( [id://1230803]=note: print w/replies, xml ) Need Help??


in reply to Looking for a Regex

Some other resources: perlre, perlretut, perlrecharclass, Regexp Quote-Like Operators, and Pattern Matching, Regular Expressions, and Parsing.

Also see Short, Self Contained, Correct (Compilable), Example and How to ask better questions using Test::More and sample data. For the latter, both for asking questions and for general development, maybe something like:

use warnings; use strict; use Test::More 'no_plan'; use Test::NoWarnings; my @TESTS = ( # dirty # clean [ q{The 99th bottle's x-o-x labels'} => q{The 99th bottle's labels'} + ], ... ); VECTOR: for my $ar_vector (@TESTS) { if (not ref $ar_vector) { note $ar_vector; next VECTOR; } my ($dirty, $expected) = @$ar_vector; my $clean = clean_it_up($dirty); ok $clean eq $expected, qq{'$dirty' -> '$clean'}; } # end for VECTOR done_testing; exit; # subroutine(s) ############################## sub clean_it_up { ... } ...
See Test::More and friends.

Update: Changed to using q{...} in example code test sentences (was '...') because it's more compatible with embedded single-quotes. (Also a trivial wording change.)


Give a man a fish:  <%-{-{-{-<

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1230803]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (3)
As of 2024-04-19 04:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found