Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Using sprintf in regular expression.

by hippo (Archbishop)
on Feb 03, 2022 at 11:23 UTC ( [id://11141099]=note: print w/replies, xml ) Need Help??


in reply to Using sprintf in regular expreession.

rsFalse has given you a good general-purpose answer. However, since you are manipulating dates, you could always use a date module such as the core module Time::Piece.

use strict; use warnings; use Time::Piece; use Test::More tests => 1; my $date = '3-15-1932'; my $want = '1932-03-15'; my $have = Time::Piece->strptime ($date, '%m-%d-%Y')->date; is $have, $want;

🦛

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11141099]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (2)
As of 2026-01-14 01:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your view on AI coding assistants?





    Results (118 votes). Check out past polls.

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.