in reply to Converting files and links to lowercase

You might want to try one of the modules that parses html, or you could try...
# read file into $file $file =~ s/href\s*=\s*("|')(.*?)\1/'href="'.lc($2).'"'/ges; $file =~ s/src\s*=\s*("|')(.*?)\1/'src="'.lc($2).'"'/ges; # write file here

It's a little complicated, this regex, and I'm too tired to explain it all (sorry), but you can use the Camel or docs to fill in the blanks...

cLive ;-)

ps - it assumes that all URL's etc are well formed. For safety, you might want to use this instead:

$file =~ s/href\s*=\s*("|')([^>]*?)\1/'href="'.lc($2).'"'/ges; $file =~ s/src\s*=\s*("|')([^>]*?)\1/'src="'.lc($2).'"'/ges;

Replies are listed 'Best First'.
Re: Re: Converting files and links to lowercase
by gav^ (Curate) on Jan 29, 2002 at 09:46 UTC
    You can do the lower casing inline like:
    my $x = "The quick brown fox etc..."; $x =~ s/\b(\w)(\w+)\b/\U$1\L$2/g; print $x, "\n";

    Though I'm not sure if this looks more or less like line noise :)

    gav^

Re: (cLive ;-) Re: Converting files and links to lowercase
by Anonymous Monk on Jan 31, 2002 at 02:45 UTC

    Thanks for the regexp solutions—but I think I'll be giving the module solution a go first.

    Hadley