#!/usr/bin/env perl -l use strict; use warnings; use Test::More; my @tests = ( ['12', '12'], ['123', '>123<>123<'], ['1234', '>1234<>1234<'], ['12345', '12345'], ['123 4567 890', '>123<>123< >4567<>4567< >890<>890<'], ['123 4567 89', '>123<>123< >4567<>4567< 89'], ['123-4567-890', '123-4567-890'], ['01/02/2017', '01/02/2017'], ['2017-01-02T17:01:34', '2017-01-02T17:01:34'], ["12\n345\n6789\n0", "12\n>345<>345<\n>6789<>6789<\n0"], ); plan tests => scalar @tests; my $re = qr{(?x: (?$1<>$1