Regular Expressions (or regexes) are a compact way of specifying patterns in a text. While Django URLconfs allow arbitrary regexes for powerful URL matching, you will probably only use a few regex symbols in practice. Below table lists a selection of common symbols:
  
For more on regular expressions, see the Python regex documentation, visit: https://docs.python.org/2/library/re.html
| Symbol | 
      Matches | 
    
| . (dot) | 
      Any single character | 
    
| \d | 
      Any single digit | 
    
| [A-Z] | 
      Any character between A and Z (uppercase) | 
    
| [a-z] | 
      Any character between a and z (lowercase) | 
    
| [A-Za-z] | 
      Any character between A and z (case insensitive) | 
    
| + | 
      One or more of the previous expression (for example, \d+ matches one or more digits) | 
    
| [^/]+ | 
      One or more characters until (and not including) a forward slash | 
    
| ? | 
      Zero or one of the previous expression (for example, \d? matches zero or one digits) | 
    
| * | 
      Zero or more of the previous expression (for example, \d* matches zero, one or more than one digit) | 
    
| {1,3} | 
      Between one and three (inclusive) of the previous expression (for example, \d{1,3} matches one, two or three digits) | 
For more on regular expressions, see the Python regex documentation, visit: https://docs.python.org/2/library/re.html
No comments:
Post a Comment