File Coverage

blib/lib/Regexp/Pattern/Instagram.pm
Criterion Covered Total %
statement 3 3 100.0
branch n/a
condition n/a
subroutine 1 1 100.0
pod n/a
total 4 4 100.0


line stmt bran cond sub pod time code
1             package Regexp::Pattern::Instagram;
2              
3 1     1   466137 use strict;
  1         3  
  1         311  
4              
5             our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
6             our $DATE = '2025-03-27'; # DATE
7             our $DIST = 'Regexp-Pattern-Instagram'; # DIST
8             our $VERSION = '0.001'; # VERSION
9              
10             our %RE = (
11             username => {
12             summary => 'Instagram username',
13             pat => qr/(?:[A-Za-z0-9_]{1,30}|[A-Za-z0-9_](?:[A-Za-z0-9_]|\.(?!\.)){1,28}[A-Za-z0-9_])/,
14             description => <<'MARKDOWN',
15              
16             Maximum 30 characters. Can contain letters, numbers, underscores, and dots. Dots
17             cannot appear at the beginning or end, and cannot appear consecutively.
18              
19             MARKDOWN
20             examples => [
21             {str=>'perlancar', anchor=>1, matches=>1},
22             {str=>'perl ancar', anchor=>1, matches=>0, summary=>"Contains invalid character (space)"},
23             {str=>'perl.ancar', anchor=>1, matches=>1},
24             {str=>'per.lan.car', anchor=>1, matches=>1},
25             {str=>'__perlancar__', anchor=>1, matches=>1},
26             {str=>'a234567890b234567890c234567890', anchor=>1, matches=>1},
27             {str=>'a234567890b234567890c234567890_', anchor=>1, matches=>0, summary=>"Too long"},
28             {str=>'.perlancar', anchor=>1, matches=>0, summary=>"Dot cannot appear at the beginning"},
29             {str=>'perlancar.', anchor=>1, matches=>0, summary=>"Dot cannot appear at the end"},
30             {str=>'perl..ancar', anchor=>1, matches=>0, summary=>"Dot cannot appear consecutively"},
31             ],
32             },
33             );
34              
35             1;
36             # ABSTRACT: Regexp patterns related to Instagram
37              
38             __END__