develooper Front page | perl.perl6.users | Postings from October 2018

A regex that tickles me

October 3, 2018 01:45
A regex that tickles me
Message ID:
Hi All,

This regex just tickles me.  I am converting a date
(2018-09-15) I harvest from a web page into a
revision number (2018.09.15).  The particular web site
only dates for their releases, so, no problem, I am using
Perl 6

#!/usr/bin/env perl6

my Str $x = "2018-09-15";
$x ~~ s/ (<:N>**4) "-" (<:N>**2) "-" (<:N>**2) /$0.$1.$2/;
say $x;


I am starting to just peal off regex's.  They are also starting
to become fun.  (Uh oh, did I just admit to brain damage?)


-T Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About