×
Home About Us Products Services News Free Scripts Contact
news php scripts and software

Perl example - Perl regular expressions character classes


Perl - Perl regular expressions character classes

\d A digit, same as [0-9] 
\D A nondigit, same as [^0-9] 
\w A word character (alphanumeric), same as [a-zA-Z_0-9] 
\W A nonword character, [^a-zA-Z_0-9] 
\s A whitespace character, same as [\t\n\r\f] 
\S A non-whitespace character, [^\t\n\r\f] 
^ Matches at the beginning of the string (or line, if /m used)
$ Matches at the end of the string (or line, if /m used)
\b Matches at word boundary (between \w and \W)
\B Matches except at word boundary
\A Matches at the beginning of the string
\Z Matches at the end of the string or before a newline
\z Matches only at the end of the string
\G Matches where previous m//g left off

Maximal Minimal Allowed Range 
{n,m} {n,m}? Must occur at least n times but no more than m times
 
{n,} {n,}? Must occur at least n times
 
{n} {n}? Must match exactly n times
 
* *? 0 or more times (same as {0,})
 
+ +? 1 or more times (same as {1,})
 
? ?? 0 or 1 time (same as {0,1})

Category: Perl

 
<< Go back