From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Michael Slass Newsgroups: gmane.emacs.help Subject: Re: Regular expression - replace lower case to upper case Date: Fri, 01 Nov 2002 02:32:32 GMT Organization: AT&T Broadband Sender: help-gnu-emacs-admin@gnu.org Message-ID: References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1036119071 3487 80.91.224.249 (1 Nov 2002 02:51:11 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Fri, 1 Nov 2002 02:51:11 +0000 (UTC) Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 187Rtt-0000u1-00 for ; Fri, 01 Nov 2002 03:51:09 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10) id 187Rre-0003P2-00; Thu, 31 Oct 2002 21:48:50 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!canoe.uoregon.edu!arclight.uoregon.edu!wn13feed!worldnet.att.net!204.127.198.204!attbi_feed4!attbi.com!rwcrnsc51.ops.asp.att.net.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 35 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Original-NNTP-Posting-Host: 12.228.27.239 Original-X-Complaints-To: abuse@attbi.com Original-X-Trace: rwcrnsc51.ops.asp.att.net 1036117952 12.228.27.239 (Fri, 01 Nov 2002 02:32:32 GMT) Original-NNTP-Posting-Date: Fri, 01 Nov 2002 02:32:32 GMT Original-Xref: shelby.stanford.edu gnu.emacs.help:106637 Original-To: help-gnu-emacs@gnu.org Errors-To: help-gnu-emacs-admin@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.help:3186 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:3186 "Rod Farmer" 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 with upper case > 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