help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: capitalize string using regular expressions


From: Greg Hill
Subject: Re: capitalize string using regular expressions
Date: Fri, 5 Dec 2003 19:29:35 -0800

At 12:53 AM +0000 12/6/03, colin smith wrote:
    Does anyone know how I can replace all occurences of  any strings that
end with ".txt" (lets say "ghjkl.txt" and "xyz.txt") with their uppercase
equivalents(ie. "GHJKL.txt" and "XYZ.txt").  There must be some way of doing
this using regular expressions. I've looked extensively through the emacs
help, but havent been able to figure it out.

(while (re-search-forward "\\W\\(\\w+\\)\\.txt\\W" nil t)
    (replace-match (upcase (match-string-no-properties 1))
                   nil nil nil 1)))

--Greg




reply via email to

[Prev in Thread] Current Thread [Next in Thread]