From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Yuri Khan Newsgroups: gmane.emacs.help Subject: Regexp: match any character including newline Date: Wed, 16 Oct 2013 21:42:54 +0700 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1381934863 27563 80.91.229.3 (16 Oct 2013 14:47:43 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 16 Oct 2013 14:47:43 +0000 (UTC) To: "help-gnu-emacs@gnu.org" Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Oct 16 16:47:47 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VWSO1-0007uS-7A for geh-help-gnu-emacs@m.gmane.org; Wed, 16 Oct 2013 16:47:45 +0200 Original-Received: from localhost ([::1]:47667 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VWSO0-000227-Rm for geh-help-gnu-emacs@m.gmane.org; Wed, 16 Oct 2013 10:47:44 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40859) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VWSJN-0004ee-18 for help-gnu-emacs@gnu.org; Wed, 16 Oct 2013 10:42:58 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VWSJL-0002MM-Je for help-gnu-emacs@gnu.org; Wed, 16 Oct 2013 10:42:56 -0400 Original-Received: from mail-qe0-x230.google.com ([2607:f8b0:400d:c02::230]:46864) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VWSJL-0002ME-FL for help-gnu-emacs@gnu.org; Wed, 16 Oct 2013 10:42:55 -0400 Original-Received: by mail-qe0-f48.google.com with SMTP id d4so673893qej.35 for ; Wed, 16 Oct 2013 07:42:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=bLYGoPSjAyAYBoFwuRhPU1LMLDE2NjcFRH+FwAiBEF8=; b=Dc+21lvaFtH+f237qr/YzjElNBhlOpJhl32VWKDRd9ah53faSyR3hrRZ+ogXUD5Yjm CkrVN+ob3CzWEfWvhzmgPZ6yzsSA+H9IOe6celTAL9GwF/WViUd7LGdCuIGB45WwTy6j 53ySJgzkq2zRz8ow7w0uW0UaC3piEzQYOUFDfKEtgBeoTkXRbQy2YOZlypRYJpTcyFpd YoZD/0Hccm/xH2tY9OOHjBDsskKG14haOjT6RFI1+u9w6mj9y8LPN4mcfHz3CGi1f5uT qMZsbAsLQ/29xMuQBizFAa4qRb1wtwOcR1hcQ6gQcyRB1ImLFtkkNtTzTexoyN/LleK3 53TA== X-Received: by 10.49.94.72 with SMTP id da8mr4141336qeb.67.1381934574530; Wed, 16 Oct 2013 07:42:54 -0700 (PDT) Original-Received: by 10.96.2.167 with HTTP; Wed, 16 Oct 2013 07:42:54 -0700 (PDT) X-Google-Sender-Auth: G1tkfl-I9duafSTPrivdxmSt8Ew X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400d:c02::230 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:94038 Archived-At: Hello All, I=E2=80=99m doing regexp replacements on a hard-wrapped XHTML-alike. Here= =E2=80=99s an original fragment: =3D=3D=3D
X(n, t)
X a(n, t)

T shall be Copy­Insert­able into X.

post: distance(begin(), end()) =3D=3D n

Constructs a sequence container with n copies of t

=3D=3D=3D Here=E2=80=99s what I need to turn it into: =3D=3D=3D
X(n, t)
X a(n, t)

T shall be Copy­Insert­able into X.

post: distance(begin(), end()) =3D=3D n

Constructs a sequence container with n copies of t

=3D=3D=3D To this end, I want to do a regexp replace of: =3D=3D=3D \(.*?\)\(.*?\) \(.*?\) =3D=3D=3D with =3D=3D=3D \1 \2 \3 =3D=3D=3D except that =E2=80=9C.=E2=80=9D needs to match any character including newl= ine. I know the obvious solution: instead of =E2=80=9C.=E2=80=9D, use the follow= ing monstrosity: =3D=3D=3D \(?:.\| \) =3D=3D=3D 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 =E2=80=9C.=E2=80=9D match newline too, or is there a= n easier way to match any character including newline? (I don=E2=80=99t want to limi= t myself to [:ascii:] as there are also Unicode-specific dashes.) For now, I=E2=80=99ve devised a workaround of using [^@] where @ is a character that does not occur in the text. Maybe [^^] since it=E2=80=99s easier to type and looks cute :)