 |
|
 |
| |
Developer on focus
Anton Zamov is a dipl. engineer with more than 6 years of active professional
experience and many awards ...
read more>>
|
|
 |
 |
 |
|
 |
|
 |
| |
|
Regular expressions, using wildcards?
|
. Match any character
\\w Match "word" character (alphanumeric plus "_")
\\W Match non-word character
\\s Match whitespace character
\\S Match non-whitespace character
\\d Match digit character
\\D Match non-digit character
\\t Match tab
\\n Match newline
\\r Match return
\\f Match formfeed
\\a Match alarm (bell, beep, etc)
\\e Match escape
\\021 Match octal char ( in this case 21 octal)
\\xf0 Match hex char ( in this case f0 hexidecimal)
You can follow any character, wildcard, or series of characters and/or wildcard with a repetiton. Here's where you start getting some power:
* Match 0 or more times
+ Match 1 or more times
? Match 1 or 0 times
{n} Match exactly n times
{n,} Match at least n times
{n,m} Match at least n but not more than m times
Now for some examples:
$string =~ m/\\s*rem/i; #true if the first printable text is rem or REM
$string =~ m/^\\S{1,8}\\.\\S{0,3}/; # check for DOS 8.3 filename
# (note a few illegals can sneak thru)
|
About the author of this programming example or tutorial:
Anton Zamov is a software engineer with more than6 years
of active experience in web and software development and design.
Anton Zamov has extensive experience and broad knowledgebase
in C# and JAVA programming and has created a lot of
running e-commerce systems, portals and content management
systems using PHP and other web development technologies.
For more information about Anton Zamov, you may visit the personal web site of
Anton Zamov.
|
|
|
 |
 |
 |
|
|