unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* regexp matches, but in some cases changes replace-match
@ 2012-08-20 10:13 Gijs Hillenius
  2012-08-20 10:17 ` Gijs Hillenius
  0 siblings, 1 reply; 2+ messages in thread
From: Gijs Hillenius @ 2012-08-20 10:13 UTC (permalink / raw)
  To: help-gnu-emacs


I use the following function to put some basic html tags in a text. The
regexp matches all subheadings.

,----
| (defun subheading ()
|   (interactive) ;; interactive for testing purpose
|   (while (re-search-forward ".*[a-zA-Z':][\n]" nil t) (replace-match "<br />\n<strong>\\&</strong><br />" nil nil)))
`----

What I don't understand: when the subheading is a single word, the
replace-match changes to "<Br />\n<Strong>\\&</Strong><Br />" (the tags
get capitals). My regexp is, somehow, inprecise.


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

* Re: regexp matches, but in some cases changes replace-match
  2012-08-20 10:13 regexp matches, but in some cases changes replace-match Gijs Hillenius
@ 2012-08-20 10:17 ` Gijs Hillenius
  0 siblings, 0 replies; 2+ messages in thread
From: Gijs Hillenius @ 2012-08-20 10:17 UTC (permalink / raw)
  To: help-gnu-emacs

On 20 Aug 2012, Gijs Hillenius wrote:

>
> I use the following function to put some basic html tags in a

Doh.

Never mind. 

Re-read the function description and now noticed the word 'fixedcase'. 

so I should use

(replace-match "foo" t nil)
instead of 
(replace-match "foo" nil nil)


-- 
You get along very well with everyone except animals and people.


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

end of thread, other threads:[~2012-08-20 10:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-20 10:13 regexp matches, but in some cases changes replace-match Gijs Hillenius
2012-08-20 10:17 ` Gijs Hillenius

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