[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: FW: Help with Emacs Regex
From: |
Kai Großjohann |
Subject: |
Re: FW: Help with Emacs Regex |
Date: |
Fri, 18 Jul 2003 22:22:21 +0200 |
User-agent: |
Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 (gnu/linux) |
"Hortman, Mark" <markh@JohnsAuto.com> writes:
> I was previously given a barf bag and the regex of
> ^\([^"]\|.[^0-9]\|..[^0-9]\|...[^0-9]\)
>
> and that seems to pass all of my tests so far.
Yes, that's the solution. In your case, it's even not too ugly. But
negating a regexp in the middle of a line is much uglier...
You could have done it with Lisp, along the lines of
(while (and (looking-at "regexp-for-okay-lines")
(not (eobp)))
(forward-line 1))
That finds the first line that looks bad. Hm. For the bad lines you
want to join them with the previous line, right? Hm. Ah:
(while (and (looking-at "regexp-for-okay-lines")
(not (eobp)))
(delete-indentation)
(forward-line 1))
I think that would have done it for you. And once you realize that
eobp stands for end-of-buffer-p, it's easy to grok.
--
~/.signature
- Re: Help with Emacs Regex, Barry Margolin, 2003/07/16
- Re: Help with Emacs Regex, Kai Großjohann, 2003/07/18
- FW: Help with Emacs Regex, Hortman, Mark, 2003/07/18
- Re: FW: Help with Emacs Regex,
Kai Großjohann <=
- Re: FW: Help with Emacs Regex, Stefan Monnier, 2003/07/18