Skip to content

Instantly share code, notes, and snippets.

@kyanny
Created October 21, 2009 11:01
Show Gist options
  • Save kyanny/215028 to your computer and use it in GitHub Desktop.
Save kyanny/215028 to your computer and use it in GitHub Desktop.
qr/^(-[5}|-{7})\n$/;
#!/usr/bin/env perl
use strict;
use Test::More;
plan tests => 6;
my $re = qr/^(-{5}|-{7})\n$/;
my $ret;
my $str1 = "-----\n"; # 5
ok( ($str1 =~ /$re/) );
my $str2 = "-----"; # 5
ok(! ($str2 =~ /$re/) );
my $str3 = "------\n"; # 6
ok(! ($str3 =~ /$re/) );
my $str4 = "------"; # 6
ok(! ($str4 =~ /$re/) );
my $str5 = "-------\n"; # 7
ok( ($str5 =~ /$re/) );
my $str6 = "-------\n"; # 7
ok( ($str6 =~ /$re/) );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment