vim.regex
Methods2
function regex.match_str(str: string) -> (nil | integer, nil | integer)
Matches string str against this regex. To match the string precisely, surround the regex with "^" and "$". Returns the byte indices for the start and end of the match, or nil if there is no match. Because any integer is "truthy", regex:match_str() can be directly used as a condition in an if-statement.
Parameters
strstring
Returns
- nil | integer
match start (byte index), or
nilif no match- nil | integer
match end (byte index), or
nilif no match
function regex.match_line(buf: integer, line_idx: integer, start: nil | integer, end_: nil | integer) -> (nil | integer, nil | integer)
Matches line at line_idx (zero-based) in buffer buf. Match is restricted to byte index range start and end_ if given, otherwise see |regex:match_str()|. Returned byte indices are relative to start if given.
Parameters
bufintegerline_idxintegerstartnil | integerend_nil | integer
Returns
- nil | integer
match start (byte index) relative to
start, ornilif no match- nil | integer
match end (byte index) relative to
start, ornilif no match