Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Regex To Remove File Extension

by johngg (Abbot)
on Dec 11, 2008 at 00:14 UTC ( #729566=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my $rxParsePath = qr
       {(?x)               # Use extended regular expression syntax to
    ...
                           # be a file name part
          $                # Anchor pattern to end of string
       };
    
  2. or download this
    use strict;
    use warnings;
    ...
       map { sprintf qq{%20s%15s%15s%10s%10s\n}, @$_ }
       map { [ $_, map { defined $_ ? $_ : q{} } m{$rxParsePath} ] }
       qw  { /etc/motd /var/adm/messages.1 .alias a.html ab.cd.txt /bin };
    
  3. or download this
                    Path      Directory      File Name File Stub Extension
               /etc/motd          /etc/           motd      motd
    ...
                  a.html                        a.html         a     .html
               ab.cd.txt                     ab.cd.txt     ab.cd      .txt
                    /bin              /            bin       bin
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (17)
As of 2015-07-31 12:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (277 votes), past polls