all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* regexp question
@ 2011-01-06 16:14 Thorsten Bonow
  2011-01-07 10:05 ` tomas
  0 siblings, 1 reply; 15+ messages in thread
From: Thorsten Bonow @ 2011-01-06 16:14 UTC (permalink / raw)
  To: help-gnu-emacs


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



^ permalink raw reply	[flat|nested] 15+ messages in thread
[parent not found: <20040924194238.40080.qmail@web51606.mail.yahoo.com>]
* RE: RegExp  question
@ 2004-09-23 20:23 JayBingham
  2004-09-24 19:43 ` Ryan Bowman
  0 siblings, 1 reply; 15+ messages in thread
From: JayBingham @ 2004-09-23 20:23 UTC (permalink / raw)


On Thursday, September 23, 2004 11:42 AM Ryan Bowman wrote:

> So I changed it to this "repeat\\(-[xy]?\\)?[^:]"
> so it won't match background-repeat: but then it no
> longer matches repeat,
> I assume because [^:] actually means to match
> something, but not a ':'
> so how do I specifiy that I don't care if anything
> follows the patter or not,
> so long as it is NOT ':'?

I am curious which version of emacs you are running.  I have emacs
21.2 loaded on my Windows 2k system and the above regexp matches
every repeat in your message except those followed by a ":" and one
that I added at the end of the buffer which does not have anything
following it.  You are correct in your assumption that [^:] actually
means to match something.  Remember that a new line is something, as
opposed to nothing.  This means that when repeat occurs at the end of
a line the new line is included in the matched string and point will
follow it (be at the start of the next line) so it may appear that it
was not matched.

<Do not reply to the above address, reply only to the list>

-_
J_)
C_)ingham
.    Hewlett-Packard
.    Austin, TX
. “Language is the apparel in which your thoughts parade in public.
.  Never clothe them in vulgar and shoddy attire.”     -Dr. George W.
Crane-

^ permalink raw reply	[flat|nested] 15+ messages in thread
[parent not found: <mailman.3776.1095958718.1998.help-gnu-emacs@gnu.org>]
* RegExp  question
@ 2004-09-23 16:41 Ryan Bowman
  2004-09-23 18:05 ` Greg Hill
  0 siblings, 1 reply; 15+ messages in thread
From: Ryan Bowman @ 2004-09-23 16:41 UTC (permalink / raw)


I have a regexp "repeat\\(-[xy]?\\)?" this should
match
repeat
repeat-x
repeat-y
, which it does, however it also matches 
background-repeat:
which I don't want it to.
So I changed it to this "repeat\\(-[xy]?\\)?[^:]"
so it won't match background-repeat: but then it no
longer matches repeat,
I assume because [^:] actually means to match
something, but not a ':'
so how do I specifiy that I don't care if anything
follows the patter or not,
so long as it is NOT ':'?




=====
---
Ryan

The door at the end of the tunnel is far too small...
 - Closing In 2.0 - Don't Be Afraid - Information Society - insoc.org
---

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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

end of thread, other threads:[~2011-01-07 10:05 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.7384.1159203371.9609.help-gnu-emacs@gnu.org>
2006-09-26  0:52 ` replace a textblock in multiple files Benjamin Rutt
2006-09-26 11:18   ` AW: " C.Strobl
2006-09-26 12:09     ` regexp question C.Strobl
2006-09-26 17:16       ` Peter Dyballa
2006-09-29 22:03         ` Dieter Wilhelm
2006-09-30  8:53           ` Peter Dyballa
     [not found]     ` <mailman.7422.1159272599.9609.help-gnu-emacs@gnu.org>
2006-09-27  7:58       ` Florian Kaufmann
2011-01-06 16:14 Thorsten Bonow
2011-01-07 10:05 ` tomas
     [not found] <20040924194238.40080.qmail@web51606.mail.yahoo.com>
2004-09-28 18:21 ` RegExp question JayBingham
  -- strict thread matches above, loose matches on Subject: below --
2004-09-23 20:23 JayBingham
2004-09-24 19:43 ` Ryan Bowman
     [not found] <mailman.3776.1095958718.1998.help-gnu-emacs@gnu.org>
2004-09-23 18:09 ` Stefan Monnier
2004-09-23 16:41 Ryan Bowman
2004-09-23 18:05 ` Greg Hill

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.