View Single Post
Old 11-03-2003, 06:46 PM   PM User | #6
cedsn
New Coder

 
Join Date: Aug 2002
Location: san marcos TX
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
cedsn is an unknown quantity at this point
i'm no regular expressions expert, but i can offer a little explanantion.

Quote:
but, what is the $data =~ tr/A-Z/a-z/; doing?
[tr]anslating any character in the A-Z set of capital letters to its corresponding lowercase character.. or in other words,

tr/target set/replacement set/;

Quote:
ans in the following...$data =~ s/\b(\w)/\U$1/g;
s = substitute

\b = border so it's looking for a word border
\w = word charachter (like a letter).. since it's in parentheses that means we can refer to this match later in the replacement area..

\U means to uppercase it
$1 refers to the match we found in parentheses, if there were multiple parenteses in our target pattern they would be referred to as $2, $3, etc

then the g; modifier means global, so it searches and replaces every match it can, the i modifier i think has to do with case, not sure about m, but i do know the modifier goes at the end. hope this helps, and there is plenty of info on regular expressions out there to look up though i find it pretty confusing.
cedsn is offline   Reply With Quote