Next: , Previous: , Up: Regular Expression Searching in Programs   [Index]


8.4.3.2 string-match

Function: string-match regexp string &optional start

This function returns the index of the start of the first match for the regular expression REGEXP in STRING, or ‘nil’ if there is no match

REGEXP

regexp to match against

STRING

string to use for match

START

if non-nil, start search at that index in STRING

RETURN VALUE

index of the start of the first match in STRING, or nil if there is no match.

(match-end 0)

If this function finds a match, the index of the first character beyond the match is available as ‘(match-end 0)’.

You can use the function match-string to extract the substrings matched by the parenthesis constructions in REGEXP.