Convert links to lowercase

Any questions involving matching text strings to patterns - the pattern is called a "regular expression."

Moderator: General Moderators

Post Reply
superdez
Forum Commoner
Posts: 33
Joined: Tue Jul 03, 2007 1:36 pm

Convert links to lowercase

Post by superdez »

The following script to change all links to lowercase is incorrect: Why??? The scripts selects the links correctly but then replace them with this: href="\L\E"



Change this:

href="All-Links-On-My-Site.html"

To this:

href="all-links-on-my-site.html"


Find:

[ \t\r\n]*href[ \t\r\n]*=[ \t\r\n]*"(.*)html"

Replace:

href="\L\1\E"
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

There's no regular expression in PHP that alters case. Use preg_replace_callback().
Post Reply