Thanks hippo.. I was not aware of the Test::More library, I do think that it works to explain what I was looking to do pretty well
I included the tests with the working and non working regex
#!/usr/bin/perl use strict; use warnings; use Test::More; my $regex = "/pce_rx_n1/"; like( "pce_rx_n1", $regex, "Matching my regex" ); like( "pce_rx_n1_blah", $regex, "Matching my regex" ); # #these fail because my $regex matches n1 and n10 and n13 # unlike( "pce_rx_n13", $regex, "Not Matching my regex" ); unlike( "pce_rx_n10_blah", $regex, "Not Matching my regex" ); #fix the regex with the #zero look-ahead negative assertion $regex = "/pce_rx_n1(?!\\d)/"; like( "pce_rx_n1", $regex, "Matching my regex" ); like( "pce_rx_n1_blah", $regex, "Matching my regex" ); unlike( "pce_rx_n12", $regex, "Not Matching my regex" ); unlike( "pce_rx_n10_blah", $regex, "Not Matching my regex" ); done_testing;
In reply to Re^2: regular expression to match specific members of a bus_name
by boleary
in thread regular expression to match specific members of a bus_name
by boleary
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |