all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Michael Slass <miknrene@drizzle.com>
Subject: Re: Regular expression - replace lower case to upper case
Date: Fri, 01 Nov 2002 02:32:32 GMT	[thread overview]
Message-ID: <m31y66koha.fsf@localhost.localdomain> (raw)
In-Reply-To: apslo1$iuj$1@mulga.cs.mu.OZ.AU

"Rod Farmer" <raf@cs.mu.oz.au> writes:

>Hi,
>    I've been looking through the manuals and can't seem to find how to
>replace all occurences of HTML tags in lower case, ie <body> with upper case
><BODY> as seems to be the W3C standards for 4.01
>
>I was going to use M-x % regexp RET string RET but what I really want is
>something like the s/foo/bar/g where
>bar can actually be a reference back to the string that has been
>matched.....
>
>
>thanks heaps
>
>
>Rod
>
>

Try this:

(defun upcase-html-tags (buf)
 (interactive "*bUpcase html tags in buffer: ")
  (save-excursion
    (set-buffer buf)
    (goto-char (point-min))
    (let ((counter 0))
      (while (re-search-forward "<\\(\\w+\\)>" nil t)
        (upcase-region (match-beginning 1) (match-end 1))
        (setq counter (1+ counter)))
      (message "upcased %d html tags" counter)))) 

-- 
Mike Slass

  reply	other threads:[~2002-11-01  2:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-01  4:33 Regular expression - replace lower case to upper case Rod Farmer
2002-11-01  2:32 ` Michael Slass [this message]
2002-11-01 19:34   ` Reiner Steib
2002-11-01 21:49     ` Michael Slass
2002-11-01  2:33 ` David Forrest

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m31y66koha.fsf@localhost.localdomain \
    --to=miknrene@drizzle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.