Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Generalizing a REGEX

by davido (Cardinal)
on Aug 08, 2020 at 19:33 UTC ( #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
Node Status?
node history
Node Type: note [id://11120505]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2021-03-07 18:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favorite kind of desktop background is:











    Results (122 votes). Check out past polls.

    Notices?