[Perl] localization and internatiolization
Reuven M. Lerner
reuven at lerner.co.il
Wed Jan 30 12:27:41 PST 2002
>>>>> Shlomo wrote:
Shlomo> Hello. I need a way to represent all capital letters in a
Shlomo> regular expression.
Shlomo> [A-Z] doesn't cut it anymore, as I might be working with a
Shlomo> locale of a languale/country other than English/American.
Use the POSIX character class syntax [:upper:] within your pattern, as
documented in 'perldoc perlre'. For example:
if ($word =~ /^[[:upper:]]+$/)
{
print "The word '$word' contains only uppercase letters!";
}
else
{
print "The word '$word' contains lowercase letters.";
}
Reuven
More information about the Perl
mailing list