Python RegEx 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, or n) are present Try it »
[a-n] Returns a match for any lower case character, alphabetically between a and n Try it »
[^arn] Returns a match for any character EXCEPT a, r, and n Try it »
[0123] Returns a match where any of the specified digits (0, 1, 2, or 3) are present Try it »
[0-9] Returns a match for any digit between 0 and 9 Try it »
[0-5][0-9] Returns a match for any two-digit numbers from 00 and 59 Try it »
[a-zA-Z] Returns a match for any character alphabetically between a and z, 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 »


Copyright 1999-2023 by Refsnes Data. All Rights Reserved.