home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / emacs / 2714 < prev    next >
Encoding:
Internet Message Format  |  1992-07-27  |  2.2 KB

  1. Path: sparky!uunet!darwin.sura.net!gatech!psuvax1!rutgers!concert!mcnc!aurs01!klassa
  2. From: klassa@aurs01.UUCP (John Klassa)
  3. Newsgroups: comp.emacs
  4. Subject: regexp help
  5. Keywords: regexp search
  6. Message-ID: <60974@aurs01.UUCP>
  7. Date: 27 Jul 92 13:29:36 GMT
  8. Sender: news@aurs01.UUCP
  9. Reply-To: klassa%aurfs1.aur.alcatel.com@rockdal.aud.alcatel.com (John Klassa)
  10. Followup-To: comp.emacs, poster
  11. Organization: Alcatel Network Systems, Raleigh NC
  12. Lines: 50
  13.  
  14. Hi-
  15.  
  16. I'm trying to do a *single* regexp search (for use with the 'occur' function)
  17. that will find all lines that contain:
  18.  
  19.       + either an 'if' or an 'else'
  20.       + possibly several whitespace characters and maybe even a
  21.         parenthetical expression thereafter
  22.  
  23.     BUT which
  24.  
  25.       + do *not* have a curly brace { after the 'if' or 'else,' on the
  26.         same line.
  27.  
  28. Examples:
  29.  
  30. The following lines should, ideally, match:
  31.  
  32.     if (status == OK)
  33.     if     (status == OK)        /* some junk */
  34.     else
  35.     else if (status == !OK)
  36.  
  37. but the following lines should *not* match:
  38.  
  39.     if (status == OK) {         /* whitespace & comment follow */
  40.     if (DEBUG)    {
  41.     else {
  42.     else if (target == SUN4) {    /* stuff */
  43.  
  44. I can get the 'if' and the 'else' with the optional whitespace & parenthetical
  45. expression to match, but I don't know how to tell Emacs to skip the lines that
  46. have a curly brace in them.
  47.  
  48. Any help would be greatly appreciated!
  49.  
  50. Thanks!
  51. John
  52. <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
  53. <> John Klassa              <>  Father to son, overheard in a men's room: <>
  54. <> Sofware Engineer         <>  "The game will be over in an hour, son."  <>
  55. <> Alcatel Network Systems  <>  "How long's that, Dad?"                   <>
  56. <> Raleigh, NC              <>  "Sesame Street."                          <>
  57. <> (919) 850-1246           <>  "Oh."                                     <>
  58. <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
  59. <>         klassa%aurfs1.aur.alcatel.com@rockdal.aud.alcatel.com          <>
  60. <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
  61. <> The attitudes and opinions expressed herein do not necessarily         <>
  62. <> reflect those of my employer...  or those of my wife, for that matter. <>
  63. <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
  64.