upper Character Class
Whats the use [[:upper:]]?
This identifies uppercase alphabets that is from [A-Z].
$str = "AAAAbbbbcccc";
$pat = ereg_replace("[[:upper:]]","a",$str);
In the above example, the character class is used with ereg_replace. ereg_replace, replaces with string "a" as mentioned. Now,the regular expression identifies 'A' in the given string and ereg_replace replaces it with string "a" that is, in the string given "AAAAbbbbCCCC" having uppercase "A" with an lowercase "a".
print "content-type: text/htmlnn";
$str = "AAsfasaAA";
$str =~ s|[[:upper:]]|X|g;
print"Replaced String is $str";
Replaced String is XXsfasaXX
In the above example the same pattern is used to search and replace operator in perl "s///" with a global scope "g" to replace every occurence of a string, so using the pattern "s|[[:upper:]]|X|g" every occurence of an uppercase alphabets is replaced by "X".