Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Generalizing a REGEX

by davido (Cardinal)
on Aug 08, 2020 at 19:33 UTC ( [id://11120505]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my @test_cases = (
        ['cat.1', 'cat(1)'],
    ...
        my $transformed = $string =~ s/\.(\d+)$/($1)/r;
        print "[$string] --> [$transformed] wanted: [$want]. Success: ", (
    +$transformed eq $want ? "yes\n" : "no\n");
    }
    
  2. or download this
    [cat.1] --> [cat(1)] wanted: [cat(1)]. Success: yes
    [ld.so.conf.5] --> [ld.so.conf(5)] wanted: [ld.so.conf(5)]. Success: y
    +es
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (5)
As of 2024-04-16 13:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found