[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Regexp: match any character including newline
From: |
Drew Adams |
Subject: |
RE: Regexp: match any character including newline |
Date: |
Wed, 16 Oct 2013 09:53:52 -0700 (PDT) |
> “.” needs to match any character including newline.
> I know the obvious solution: instead of “.”, use the following
> monstrosity:
>
> \(?:.\|
> \)
>
> However, I find that very cumbersome to type, especially since I
> have to press C-q C-j in between.
>
> Is there a way to make “.” match newline too, or is there an easier
> way to match any character including newline?
1. I and others have requested this for vanilla Emacs a few times,
as a user toggle. E.g.:
* http://lists.gnu.org/archive/html/emacs-devel/2006-03/msg00162.html
* http://lists.gnu.org/archive/html/emacs-devel/2006-03/msg00476.html
* http://lists.gnu.org/archive/html/emacs-devel/2006-11/msg01559.html
* http://lists.gnu.org/archive/html/emacs-devel/2006-12/msg00115.html
2. In Icicles at least, you can use `C-M-.' to toggle what `.'
represents in the minibuffer (i.e., for most interactive use). When
`.' matches also a newline, it appears as `.' in the minibuffer, but
the actual regexp used under the covers is "\(.\|[
]\)". (When this is the case, it is also highlighted, so you can tell.)
IOW, when newline is also being matched by `.', this propertized string
is inserted in the minibuffer when you type `.':
#("\\(.\\|[
]\\)" 0 10 (face highlight display "."))
Not the ideal solution (hence the requests cited), but handy enough.