Shortcuts for Character Ranges in Perl

You're programming along in Perl and want to use a code shortcut to represent anything from a number to a non-number to any letter or number. You're in luck, because the following table gives you the code, shows you what it’s a shortcut for, and describes it.






































CodeReplacesDescription
\d[0..9]Any digit
\w[a-zA-Z_0-9]Any alphanumeric character
\s[ tnrf]A whitespace character
\D^[0..9]Any non-digit
\W^[a-zA-Z_0-9]Any non-alphanumeric character
\S^[ tnrf]A non-whitespace character








dummies

Source:http://www.dummies.com/how-to/content/shortcuts-for-character-ranges-in-perl.html

No comments:

Post a Comment