PythonRegEx Sets
RegEx Sets
A set is a set of characters inside a pair of square brackets[]
with a special meaning:
Set | Description | Try it |
---|---|---|
[arn] | Returns a match where one of the specified characters (a ,r , orn ) are present | Try it » |
[a-n] | Returns a match for any lower case character, alphabetically betweena andn | Try it » |
[^arn] | Returns a match for any character EXCEPTa ,r , andn | Try it » |
[0123] | Returns a match where any of the specified digits (0 ,1 ,2 , or3 ) are present | Try it » |
[0-9] | Returns a match for any digit between0 and9 | Try it » |
[0-5][0-9] | Returns a match for any two-digit numbers from00 and59 | Try it » |
[a-zA-Z] | Returns a match for any character alphabetically betweena andz , lower case OR upper case | Try it » |
[+] | In sets,+ ,* ,. ,| ,() ,$ ,{} has no special meaning, so[+] means: return a match for any+ character in the string | Try it » |
Related Pages
Python RegEx TutorialRegExRegEx FunctionsMetacharacters in RegExRegEx Special SequencesRegEx Match Object