CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Regular Expressions: Re: [jwhit61] Track. Title format for audio files: Edit Log



KevinR
Veteran


Dec 26, 2008, 6:27 AM


Views: 8946
Re: [jwhit61] Track. Title format for audio files

Just a quick look through your code I spotted these lines:


Code
$NewText =~ tr/[A-Z]/[a-z]/; #Make everything lowercase  

$NewText =~ s/\b([a-z]+)\B/ucfirst(lc($1))/eg; #Boundary ends with a Number


In the first line the square brackets are not doing anything. The square brackets do not make a character class when using tr///. tr/// is not a regular expression like s/// and m// are. Leaving them in is not hurting anything but they are being treated as literal characters and not as a character class. But to make everything lower-case, use the lc() function:

$text = lc($text);

In the second line, it looks like you would be better using \d instead of \B as the end of pattern anchor. \d is digits 0-9.
-------------------------------------------------


(This post was edited by KevinR on Dec 26, 2008, 6:29 AM)


Edit Log:
Post edited by KevinR (Veteran) on Dec 26, 2008, 6:29 AM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives