2 May 2005 14:54
Re: regex bug with pattern "\\*/" matching end of buffer */
Geoff Odhner <geoff_odhner <at> franklin.com>
2005-05-02 12:54:53 GMT
2005-05-02 12:54:53 GMT
Thank you. I am relieved to find the bug is in my code. Indeed, it works
correctly when I recode it thus:
(while (and (re-search-forward "\\*/" nil t) (replace-match
"*-/" nil nil)) (not (eobp))))
Geoff Odhner
Richard Stallman <rms <at> gnu.org> wrote on 04/30/2005 07:18:50 PM:
> (while (and (re-search-forward "\\*/" nil t) (not (eobp)))
> (replace-match "*-/" nil nil)))
>
> it will give me the following line as the result:
>
> char ch; /-* sample comment */
>
> That's because (eobp) returns t when you're at the end of the
> accessible portion of the buffer. So the bug is in your code,
> I think.
>
RSS Feed