Unix Reqular Expressions Reference

August 7, 2007 – 8:05 pm

 Tip courtesy of Kyle Reynolds at http://www.camelrichard.org

Regular Expressions Reference Sheet
———————————–

Ctr     Definition                                                     
—     ———-                                                     
^       The pattern has to appear at the beginning of a string.        

$       The pattern has to appear at the end of a string.              

.       Matches any character.                                         

[]      Bracket expression. Matches one of any characters enclosed.    

[^]     Negates a bracket expression. Matches one of any characters    
        EXCEPT those enclosed. 

[-]     Range. Matches any characters within the range.                

?       Preceeding item must match one or zero times.
                 
+       Preceeding item must match one or more times.                  

*       Preceeding item must match zero or more times.                 

()      Parentheses. Creates a substring or item that metacharacters   
        can be applied to                                    

{n}     Bound. Specifies exact number of times for the preceeding      
        item to match.

{n,}    Bound. Specifies minimum number of times for the preceeding    
                item to match.

{n,m}   Bound. Specifies minimum and maximum number of times for
        the preceeding item to match.                                  

|       Alternation. One of the alternatives has to match. 

Post a Comment