[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: replace matches in any string
From: |
Davis Herring |
Subject: |
Re: replace matches in any string |
Date: |
Thu, 2 Sep 2010 15:40:52 -0700 (PDT) |
User-agent: |
SquirrelMail/1.4.8-5.el5_4.10.lanl3 |
> This doesn't help at all.
>
> The use case is that you had some string do a match, but you don't have
> access to the string variable. You just want the matches that you know
> were made, aka perlish $1, $2, $3. I reiterate my first posting on this
> issue as a feature request.
I don't know why you'd permanently lose the string you matched against,
but m-s-r does let you write
(defun format-matches (fmt regexp str)
"Replace \\1 \\& etc. in FMT with matches from REGEXP against STR."
(string-match regexp str)
(match-substitute-replacement fmt nil nil str))
...in which case you only need to pass the string to one function.
Davis
--
This product is sold by volume, not by mass. If it appears too dense or
too sparse, it is because mass-energy conversion has occurred during
shipping.
- Re: replace matches in any string, (continued)
- Re: replace matches in any string, David Kastrup, 2010/09/02
- Re: replace matches in any string, Ted Zlatanov, 2010/09/02
- Re: replace matches in any string, David Kastrup, 2010/09/02
- Re: replace matches in any string, Ted Zlatanov, 2010/09/02
- Recommended gnus spam filter system?, Camm Maguire, 2010/09/02
- Re: Recommended gnus spam filter system?, Frank Schmitt, 2010/09/02
- Re: Recommended gnus spam filter system?, Karl Fogel, 2010/09/02
- Re: Recommended gnus spam filter system?, Thorsten Bonow, 2010/09/03
- Re: replace matches in any string, Stefan Monnier, 2010/09/02
- Re: replace matches in any string, Lars Magne Ingebrigtsen, 2010/09/02
- Re: replace matches in any string,
Davis Herring <=
- Re: replace matches in any string, David Kastrup, 2010/09/03
- Re: replace matches in any string, Lars Magne Ingebrigtsen, 2010/09/03