unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* RegExp  question
@ 2004-09-23 16:41 Ryan Bowman
  2004-09-23 18:05 ` Greg Hill
  0 siblings, 1 reply; 13+ 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] 13+ messages in thread
[parent not found: <mailman.3776.1095958718.1998.help-gnu-emacs@gnu.org>]
* RE: RegExp  question
@ 2004-09-23 20:23 JayBingham
  2004-09-24 19:43 ` Ryan Bowman
  0 siblings, 1 reply; 13+ 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] 13+ messages in thread
[parent not found: <20040924194238.40080.qmail@web51606.mail.yahoo.com>]
* AW: replace a textblock in multiple files
@ 2006-09-26 11:18 C.Strobl
  2006-09-26 12:09 ` regexp question C.Strobl
       [not found] ` <mailman.7422.1159272599.9609.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 13+ messages in thread
From: C.Strobl @ 2006-09-26 11:18 UTC (permalink / raw)




thanks, but maybe my question was too short. 

1) i want to work on several subdirectories, not only in one directory
2) i want to replace blocks consisting of more than one line.

is that possible at all

tanks again
christian

p.s. i know it's always possible with programming elisp. but i want to know if it's possible with simple emacs commands? 

> -----Ursprüngliche Nachricht-----
> Von: help-gnu-emacs-bounces+c.strobl=dlr.de@gnu.org 
> [mailto:help-gnu-emacs-bounces+c.strobl=dlr.de@gnu.org] Im 
> Auftrag von Benjamin Rutt
> Gesendet: Dienstag, 26. September 2006 02:52
> An: help-gnu-emacs@gnu.org
> Betreff: Re: replace a textblock in multiple files
> 
> <C.Strobl@dlr.de> writes:
> 
> > hello all,
> > only a short and simple question: whats the best way to replace a 
> > textblock in multiple files.
> > thanks and i hope the question is not to easy christian
> 
> M-x dired
> 
> mark desired files with 'm'
> 
> Q
> --
> Benjamin Rutt
> _______________________________________________
> help-gnu-emacs mailing list
> help-gnu-emacs@gnu.org
> http://lists.gnu.org/mailman/listinfo/help-gnu-emacs
> 

^ permalink raw reply	[flat|nested] 13+ messages in thread
* regexp question
@ 2011-01-06 16:14 Thorsten Bonow
  2011-01-07 10:05 ` tomas
  0 siblings, 1 reply; 13+ 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] 13+ messages in thread

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

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-09-23 16:41 RegExp question Ryan Bowman
2004-09-23 18:05 ` Greg Hill
     [not found] <mailman.3776.1095958718.1998.help-gnu-emacs@gnu.org>
2004-09-23 18:09 ` Stefan Monnier
  -- strict thread matches above, loose matches on Subject: below --
2004-09-23 20:23 JayBingham
2004-09-24 19:43 ` Ryan Bowman
     [not found] <20040924194238.40080.qmail@web51606.mail.yahoo.com>
2004-09-28 18:21 ` JayBingham
2006-09-26 11:18 AW: replace a textblock in multiple files 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).