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

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

regexp question


From: Thorsten Bonow
Subject: regexp question
Date: Thu, 06 Jan 2011 17:14:59 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

Hi,

I wrote the following defun:

(defun yyy-rmligs()
"Function to call `query-replace-regexp' and search
for words, ignoring LaTeX commands starting with a backslash,
which contain ligatures 'ff', 'fi', 'fl', 'ffi' and 'ffl' and
queries about replacing them with their LaTeX non-ligature
variant.  E.g. 'shelfful' could be replaced by 'shelf\"|ful',
while '\\flushright' is ignored."

  (interactive)
  (query-replace-regexp
   "\\([^\\\\]\\b\\w*\\)f\\(f\\|i\\|l\\|fi\\|fl\\)\\(\\w*\\b\\)"
   "\\1f\"|\\2\\3)"))

It works, unless there is more then one ligature in the word.

I can replace 'aaaflaaa' with 'aaaf"|laaa', but the defun fails to replace the
first occurrences of 'fl' in 'aaaflaaaflaaa'.

Help on the rexeps involved would be appreciated. Thx!

Toto

PS: Yes I know of the rmligs program; my need is for other languages than
    German.

    I know that for LaTeX documents I should (and will) use
    `reftex-query-replace-document' instead of `query-replace-regexp'.

    Do words in the English language exist which have more than one ligature?

-- 
"A Korean newspaper wrote that Aachen University is the MIT of Europe."
Burkhard Rauhut / "Anything that's the something of something isn't
really the anything of anything." Lisa Simpson



reply via email to

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