Regular Expression Patterns

The Privilege Management for Unix and Linux Security Policy Scripting Language supports extended regular pattern matching. Use these for pattern searches as well as forbidden and warning keystroke patterns.

For more information on regular expressions, please see the following:
Pattern Example Description
    Matches any character.
  abc.d Match the string abc followed by any single character then a d.
[ ]   Defines the beginning and end of a character class.
  [jJ]* Match an uppercase or lowercase j followed by any number of characters.
  [a-z] Match any lowercase characters a through z.
^   Not character (when used inside square brackets).
  [^a-z] Match any character except lowercase characters a through z.
*   Match zero or more occurrences of the last pattern.
  abc* Matches the string ab followed by zero or more c’s.
?   Match zero or one occurrences of the last pattern.
  abc? Match either ab or abc.
+   Match one or more occurrences of the last pattern.
  abc+ Match the string ab followed by one or more c’s.
{m}   Match exactly m occurrences of the last pattern.
  abc{3} Match the string abccc.
{m,}   Match m or more occurrences of the last pattern.
  abc{3,} Match abccc, abcccc, etc.
{m,n}   Match at least m, but no more than n, occurrences of the last pattern.
  abc{3,5} Match abccc, abcccc, or abccccc.
( )   Group several characters or patterns together and treat as a single group.
  a(bc)+ Match abc, abcbc, abcbcbc, and so forth.
|   Match either of two patterns.
  ab|c Match either ab or ac.
^   Match beginning of line (when outside square brackets).
  ^abc Match abc only if it appears at the beginning of a line.
$   Match end of line.
  abc$ Match abc only if it appears at the end of a line.
[:alnum:]   Matches alphanumeric characters.
[:alpha:]   Matches alpha characters.
[:blank:]   Matches spaces or tabs.
[:boundary:]   Matches a word’s boundaries.
[:cntrl:]   Matches control characters.
[:digit:]   Matches decimal digits.
[:graph:]   Matches graphical characters.
[:lower:]   Matches lowercase characters.
[:print:]   Matches printable characters.
[:punct:]   Matches punctuation marks.
[:space:]   Matches any white space.
[:upper:]   Matches uppercase characters.
[:xdigit:]   Matches hexadecimal digits.