home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!darwin.sura.net!gatech!psuvax1!rutgers!concert!mcnc!aurs01!klassa
- From: klassa@aurs01.UUCP (John Klassa)
- Newsgroups: comp.emacs
- Subject: regexp help
- Keywords: regexp search
- Message-ID: <60974@aurs01.UUCP>
- Date: 27 Jul 92 13:29:36 GMT
- Sender: news@aurs01.UUCP
- Reply-To: klassa%aurfs1.aur.alcatel.com@rockdal.aud.alcatel.com (John Klassa)
- Followup-To: comp.emacs, poster
- Organization: Alcatel Network Systems, Raleigh NC
- Lines: 50
-
- Hi-
-
- I'm trying to do a *single* regexp search (for use with the 'occur' function)
- that will find all lines that contain:
-
- + either an 'if' or an 'else'
- + possibly several whitespace characters and maybe even a
- parenthetical expression thereafter
-
- BUT which
-
- + do *not* have a curly brace { after the 'if' or 'else,' on the
- same line.
-
- Examples:
-
- The following lines should, ideally, match:
-
- if (status == OK)
- if (status == OK) /* some junk */
- else
- else if (status == !OK)
-
- but the following lines should *not* match:
-
- if (status == OK) { /* whitespace & comment follow */
- if (DEBUG) {
- else {
- else if (target == SUN4) { /* stuff */
-
- I can get the 'if' and the 'else' with the optional whitespace & parenthetical
- expression to match, but I don't know how to tell Emacs to skip the lines that
- have a curly brace in them.
-
- Any help would be greatly appreciated!
-
- Thanks!
- John
- <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
- <> John Klassa <> Father to son, overheard in a men's room: <>
- <> Sofware Engineer <> "The game will be over in an hour, son." <>
- <> Alcatel Network Systems <> "How long's that, Dad?" <>
- <> Raleigh, NC <> "Sesame Street." <>
- <> (919) 850-1246 <> "Oh." <>
- <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
- <> klassa%aurfs1.aur.alcatel.com@rockdal.aud.alcatel.com <>
- <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
- <> The attitudes and opinions expressed herein do not necessarily <>
- <> reflect those of my employer... or those of my wife, for that matter. <>
- <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
-