SetAtom: A Regex Character Set#

class my.regex.meta.SetAtom.SetAtom(data: str | Self = '', *args: Any, span: Span = <factory>, body: str = '')#

A character set in a regular expression, denoted by square brackets (e.g. [a-zA-Z]).

Examples

Break a simple set into its member atoms:

>>> SetAtom(r'[abc]').members
['a', 'b', 'c']

Sets using V1 set operators are not considered “simple”:

>>> SetAtom(r'[a-z--[aeiou]]').is_simple
False
property SetAtom.members: list[Atom]#

The individual atoms that make up this set – only valid for simple sets.

property SetAtom.is_simple: bool#

Whether this set is “simple” (i.e. contains no set operators).