in reply to AWTDI: Renaming files using regexp
You forgot to escape your dot. It will match any character, not just a dot.
Furthermore, some files have dots, but no extentions. For example, consider "Foo. Bar". ". Bar" is not an extention because it has a space in it. You can verify this by checking the properties of "Foo. Bar" and "Foo.Bar". For the former, the file type is "File", while for the latter, the file type in "BAR File". You (and everyone in this thread) mistakenly identify ". Bar" as an extention and don't convert "Foo. Bar" to "Foo_ Bar".
The correct usage would be:
fileparse($_, qr/\.[^. ]*/)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: AWTDI: Renaming files using regexp
by BrowserUk (Patriarch) on Apr 11, 2006 at 16:09 UTC | |
by ikegami (Patriarch) on Apr 11, 2006 at 16:21 UTC | |
|
Re^2: AWTDI: Renaming files using regexp
by duff (Parson) on Apr 11, 2006 at 17:07 UTC | |
by ikegami (Patriarch) on Apr 11, 2006 at 17:52 UTC | |
by duff (Parson) on Apr 11, 2006 at 18:50 UTC | |
by ikegami (Patriarch) on Apr 11, 2006 at 19:49 UTC | |
|
Re^2: AWTDI: Renaming files using regexp
by nimdokk (Vicar) on Apr 11, 2006 at 17:26 UTC |