Posix and Unicode Classes : Character Class « Regular Expression « Perl






Posix and Unicode Classes

    

Shortcut              Expansion                                       Description
[[:alpha:]]           [a-zA-Z]                                        An alphabetic character.
[[:alnum:]]           [0-9A-Za-z]                                     An alphabetic or numeric character.
[[:digit:]]           \d                                              A digit, 0-9.
[[:lower:]]           [a-z]                                           A lower case letter.
[[:upper:]]           [A-Z]                                           An upper case letter.
[[:punct:]]           [!"#$%&'()*+,-./:;<=>?@\[\\\]^_`{|}~]           A punctuation character  note the escaped characters [, \, and ].


/bea?t/ Matches either 'beat' or 'bet'
/bea+t/ Matches 'beat', 'beaat', 'beaaat'
/bea*t/ Matches 'bet', 'beat', 'beaat'

   
    
    
    
  








Related examples in the same category

1.Character Class: Alternative Characters
2.Character Class: Anchored Characters
3.Character Class: Miscellaneous Characters
4.Character Class: Remembered Characters
5.Character Class: Repeated Characters
6.Character Class: Whitespace Characters
7.Match any number of alphanumerics followed by a single space character
8.Match at least one alphanumeric followed by a single space character
9.The bracket metacharacters and negation
10.The bracketed character class