Find the position of a regular expression inside a string. If the regexp is not found, return #f, otherwise return a variable number of marks.
This function returns the index of the start of the regular expression in the big-string, or #f if the regular expression is not found. As a second value, it returns the index of the end of the regular expression in the big-string (assuming it was found; otherwise there is no second value). These values are called marks, and they come in pairs, a start-mark and an end-mark. If there are groups in the regular expression, regexp-position will return an additional pair of marks (a start and an end) for each group. If the group is matched, these marks will be integers; if the group is not matched, the marks will be #f. So
regexp-position("This is a string", "is");returns values(2, 4) and
regexp-position("This is a string", "(is)(.*)ing");returns values(2, 16, 2, 4, 4, 13), while
regexp-position("This is a string", "(not found)(.*)ing");returns #f. Marks are always given relative to the start of big-string, not relative to the start: keyword.
| big-string | An instance of <string>. The string to parse. |
| regexp | An instance of <string>. |
| start: | An instance of <integer>. Where to start parsing the string. The default is 0. |
| end: | An instance of <integer> or #f. If defined, where to stop parsing the string. The default is #f. |
| case-sensitive: | An instance of <object>. If true, match case in regexp while parsing. The default is #f. |
| regexp-start | An instance of type-union(<integer>, <false>). If #f, a match was not found. Otherwise, the index of the start of the match. |
| regexp-end | An instance of <integer>. The index of the end of the match. Not present if no match found. |
| #rest group-marks | Instances of type-union(<integer>, <false>). The indices of the start and end of each group’s match. If a group is not matched, its corresponding index values will be #f, #f. None of these values will be present if a match to the the regexp as a whole was not found. |