[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: match string to regexp
From: |
Pascal Bourguignon |
Subject: |
Re: match string to regexp |
Date: |
21 Nov 2003 07:56:16 +0100 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 |
Jesper Harder <harder@myrealbox.com> writes:
> Miguel Frasson <frasson@brutus.math.leidenuniv.nl> writes:
>
> > How to match a string against a regexp? The string is returned by
> > some function like (match-string N).
>
> ,----[ C-h f string-match RET ]
> | string-match is a built-in function.
> | (string-match REGEXP STRING &optional START)
> |
> | Return index of start of first match for REGEXP in STRING, or nil.
> | Case is ignored if `case-fold-search' is non-nil in the current buffer.
> | If third arg START is non-nil, start search at that index in STRING.
> | For index of first char beyond the match, do (match-end 0).
> | `match-end' and `match-beginning' also give indices of substrings
> | matched by parenthesis constructs in the pattern.
> |
> | You can use the function `match-string' to extract the substrings
> | matched by the parenthesis constructions in REGEXP.
> `----
Time flies like an arrow.
Fruit flies like a banana.
match-string returns the matched string.
string-match matches a string.
I just miss a function to string the matches, and another one to
return the stringed match...
--
__Pascal_Bourguignon__
http://www.informatimago.com/