Module rsre¶
Require: require("rsre")
Index¶
Api reference¶
-
class rsre.Match:
userdata¶ -
start(self):
integer¶ Get the 1-indexed start position of the match (inclusive).
-
stop(self):
integer¶ Get the 1-indexed stop position of the match (exclusive).
-
range(self):
integer,integer¶ Get the start and stop positions of the match.
See also
-
as_str(self):
string¶ Get the matched substring.
-
start(self):
-
class rsre.Captures:
userdata¶ -
get(self, index:
integer):rsre.Match¶ Get the match at the provided index.
-
name(self, name:
string):rsre.Match¶ Get match with the provided name.
-
len(self):
integer¶ Get the total number of matches.
-
get(self, index:
-
class rsre.Regex:
userdata¶ -
staticmethod new(pattern:
string):rsre.Regex¶ Compile a new regex.
-
match(self, hay:
string):boolean¶ Test if the regex matches the provided string.
-
find(self, hay:
string, pos?:integer):rsre.Match¶ Find the first, leftmost match after
pos.
-
captures(self, hay:
string, pos?:integer):rsre.Captures¶ Find the first, leftmost captures after
pos.
-
replace(self, text:
string, rep:string, limit?:integer):string¶ Replace matches in
textwithrep, optionally up tolimittimes.
-
split(self, text:
string, limit?:integer):string[]¶ Split a string at every match, optionally up to
limittimes.
-
as_str(self):
string¶ The original regex as a string.
-
staticmethod new(pattern: