Next: , Previous: , Up: Accessing Matched Text Using Match Data   [Index]


8.4.5.3 match-beginning

Function: match-beginning count

If the last regular expression search found a match, this function returns the position of the start of the matching text or of a subexpression of it.

COUNT

If COUNT is zero, then the value is the position of the start of the entire match. Otherwise, COUNT specifies a subexpression in the regular expression, and the value of the function is the starting position of the match for that subexpression.

The value is ‘nil’ for a subexpression inside a ‘\|’ alternative that wasn’t used or a repetition that repeated zero times.