[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Is it valid to use the zero-byte "^@" in regexps?
From: |
Thorsten Jolitz |
Subject: |
Is it valid to use the zero-byte "^@" in regexps? |
Date: |
Wed, 18 Jun 2014 11:14:06 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
Hi List,
when matching multi-line text, using the negated zero-byte in a regexp
is convenient to match *any* chararcter, since it should only appear in
binary files not in text files.
However, I sometimes get strange and a bit unpredictable results using
this technique.
To rule out a fundamental problem - is it valid to have the zero-byte
(inserted with C-q C-@) appear in a regexp like this?
,--------------------------------------------------------
| "^#\\+begin_src[[:space:]]+emacs-lisp[^^@]*\n#\\+end_src"
`--------------------------------------------------------
If so, this regexp should reliably match any
,-----------------------
| #+begin_src emacs-lisp
| [...]
| #+end_src
`-----------------------
no matter whats inside the block, right?
--
cheers,
Thorsten