Skip to content

module re

Source: stdlib/re.codon


A = (1 << 0)


ASCII = (1 << 0)


DEBUG = (1 << 1)


I = (1 << 2)


IGNORECASE = (1 << 2)


L = (1 << 3)


LOCALE = (1 << 3)


M = (1 << 4)


MULTILINE = (1 << 4)


S = (1 << 5)


DOTALL = (1 << 5)


X = (1 << 6)


VERBOSE = (1 << 6)


Span @tuple Class is named tuple (cannot write fields)

Fields

start: int

end: int

Magic methods

__bool__(self)


seq_re_match(re: cobj, anchor: int, string: str, pos: int, endpos: int) @pure Function has no side effects and returns same value for same inputs @C Function is external C function


seq_re_match_one(re: cobj, anchor: int, string: str, pos: int, endpos: int) @pure Function has no side effects and returns same value for same inputs @C Function is external C function


seq_re_pattern_groups(re: cobj) @pure Function has no side effects and returns same value for same inputs @C Function is external C function


seq_re_group_name_to_index(re: cobj, name: str) @pure Function has no side effects and returns same value for same inputs @C Function is external C function


seq_re_group_index_to_name(re: cobj, index: int) @pure Function has no side effects and returns same value for same inputs @C Function is external C function


seq_re_pattern_error(re: cobj) @pure Function has no side effects and returns same value for same inputs @C Function is external C function


seq_re_escape(pattern: str) @pure Function has no side effects and returns same value for same inputs @C Function is external C function


seq_re_purge() @C Function is external C function


seq_re_compile(pattern: str, flags: int) @pure Function has no side effects and returns same value for same inputs @C Function is external C function


error

Fields

pattern: str

Properties

msg @property Method is a class property

Magic methods

__init__(self, message: str = "", pattern: str = "")


Pattern @tuple Class is named tuple (cannot write fields)

Fields

pattern: str

flags: int


compile(pattern: str, flags: int = 0)


search(pattern: str, string: str, flags: int = 0)


match(pattern: str, string: str, flags: int = 0)


fullmatch(pattern: str, string: str, flags: int = 0)


finditer(pattern: str, string: str, flags: int = 0)


findall(pattern: str, string: str, flags: int = 0)


split(pattern: str, string: str, maxsplit: int = 0, flags: int = 0)


sub(pattern: str, repl, string: str, count: int = 0, flags: int = 0)


subn(pattern: str, repl, string: str, count: int = 0, flags: int = 0)


escape(pattern: str)


purge()


Match @tuple Class is named tuple (cannot write fields)

Fields

pos: int

endpos: int

re: Pattern

string: str

Properties

lastindex @property Method is a class property

lastgroup @property Method is a class property

Magic methods

__getitem__(self, g)

__copy__(self)

__deepcopy__(self)

__bool__(self)

Methods

group(self, *args)

start(self, group = 0)

end(self, group = 0)

span(self, group = 0)

expand(self, template: str)

groups(self, default: Optional[str] = None)

groupdict(self, default: Optional[str] = None)


Pattern @extend Class is extended to add given methods

Properties

groups @property Method is a class property

groupindex @property Method is a class property

Magic methods

__bool__(self)

Methods

search(self, string: str, pos: Optional[int] = None, endpos: Optional[int] = None)

match(self, string: str, pos: Optional[int] = None, endpos: Optional[int] = None)

fullmatch(self, string: str, pos: Optional[int] = None, endpos: Optional[int] = None)

finditer(self, string: str, pos: Optional[int] = None, endpos: Optional[int] = None)

findall(self, string: str, pos: Optional[int] = None, endpos: Optional[int] = None)

split(self, string: str, maxsplit: int = 0)

subn(self, repl, string: str, count: int = 0)

sub(self, repl, string: str, count: int = 0)