Created
March 2, 2018 14:47
-
-
Save robhammond/a171d67ea4e36a2af5afbb560a3eba40 to your computer and use it in GitHub Desktop.
Create a regular expression to identify evergreen content in Google Analytics
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use Modern::Perl; | |
use DateTime; | |
my $past = DateTime->now->subtract(months => 6); | |
my $past_year = $past->year(); | |
my $past_month = $past->month(); | |
my $past_2_year = $past->subtract(years => 1)->format_cldr('yy'); | |
my $y_str; | |
for my $y (@{[0..$past_2_year]}) { | |
$y_str .= sprintf("%02d", $y) . "|"; | |
} | |
chop $y_str; | |
local $" = "|"; | |
say "^(20($y_str)-[0-9]+|$past_year-0?(@{[1..$past_month]}))-[0-9]+\$"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment