unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* match string to regexp
@ 2003-11-20 18:49 Miguel Frasson
  2003-11-20 19:04 ` Jesper Harder
  0 siblings, 1 reply; 3+ messages in thread
From: Miguel Frasson @ 2003-11-20 18:49 UTC (permalink / raw)



Hi

How to match a string against a regexp? The string is returned by some
function like (match-string N).

[]'s

Miguel

-- 
Miguel Vinicius Santini Frasson
http://www.math.leidenuniv.nl/~frasson

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: match string to regexp
  2003-11-20 18:49 match string to regexp Miguel Frasson
@ 2003-11-20 19:04 ` Jesper Harder
  2003-11-21  6:56   ` Pascal Bourguignon
  0 siblings, 1 reply; 3+ messages in thread
From: Jesper Harder @ 2003-11-20 19:04 UTC (permalink / raw)


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.
`----

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: match string to regexp
  2003-11-20 19:04 ` Jesper Harder
@ 2003-11-21  6:56   ` Pascal Bourguignon
  0 siblings, 0 replies; 3+ messages in thread
From: Pascal Bourguignon @ 2003-11-21  6:56 UTC (permalink / raw)


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/

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-11-21  6:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-11-20 18:49 match string to regexp Miguel Frasson
2003-11-20 19:04 ` Jesper Harder
2003-11-21  6:56   ` Pascal Bourguignon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).