in reply to Regex To Remove File Extension
that is because you told it to take everything after a dot using a "greedy" match. You want a "non-greedy", using the ? modifier. try: /\..*?$/, alternately you could use /\.[^.]+$/ to remove a dot followed by one or more non-dot characters at the end of the string
-pete
"Worry is like a rocking chair. It gives you something to do, but it doesn't get you anywhere."
-pete
"Worry is like a rocking chair. It gives you something to do, but it doesn't get you anywhere."
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Regex To Remove File Extension
by kennethk (Abbot) on Dec 10, 2008 at 19:07 UTC | |
by dreadpiratepeter (Priest) on Dec 10, 2008 at 19:18 UTC | |
by kennethk (Abbot) on Dec 10, 2008 at 19:24 UTC |
In Section
Seekers of Perl Wisdom