From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: torys.anderson@gmail.com (Tory S. Anderson) Newsgroups: gmane.emacs.help Subject: Re: cleaning up a big regexp Date: Mon, 15 Sep 2014 07:26:17 -0400 Message-ID: <87egvdunty.fsf@gmail.com> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1410780407 24300 80.91.229.3 (15 Sep 2014 11:26:47 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 15 Sep 2014 11:26:47 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Sep 15 13:26:40 2014 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 1XTUQX-0005Ax-2F for geh-help-gnu-emacs@m.gmane.org; Mon, 15 Sep 2014 13:26:37 +0200 Original-Received: from localhost ([::1]:58907 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XTUQW-0003p8-GT for geh-help-gnu-emacs@m.gmane.org; Mon, 15 Sep 2014 07:26:36 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59803) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XTUQJ-0003oy-9V for help-gnu-emacs@gnu.org; Mon, 15 Sep 2014 07:26:26 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XTUQF-0004K3-Qc for help-gnu-emacs@gnu.org; Mon, 15 Sep 2014 07:26:23 -0400 Original-Received: from mail-yk0-x22c.google.com ([2607:f8b0:4002:c07::22c]:59380) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XTUQF-0004Jy-Lr for help-gnu-emacs@gnu.org; Mon, 15 Sep 2014 07:26:19 -0400 Original-Received: by mail-yk0-f172.google.com with SMTP id q9so1979514ykb.3 for ; Mon, 15 Sep 2014 04:26:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:references:date:in-reply-to:message-id:user-agent :mime-version:content-type; bh=GL+conilpJaEZYkBzNvQGBM+pheCRHL1UC+yDLF7HJs=; b=ls6SV56NUB6AbPpyV8yJNNksE9wKchcS3Z7bRxFrkw2XA9IevnnTvsN9oWRRKpP1HJ /WBUY0JZcQR5A7Kx0ZSas3hOo/+nRbADgQkgACFWeeBcyJ3CzMlCSE5w9WzEDGN5D+AV O9YJVhGiz2HkrMlWMPiepXCsfmhgcZ7pYYwM10C6AMljLyi3IlP5GB4lQNu9irOdZgeM StjYWJIChsxjLyxmrGJkuUY70sPK6fiJTIfnjJgFN35cJv9tSTTGMLumG9pTHJpVDzqq 6p8mKsDRE/fJIwBmSBiOHwon6YK30yP51T8He+pFR1d0O/j8u8WBgFj8JpBrkfffwJ+g ZwxQ== X-Received: by 10.236.222.103 with SMTP id s97mr121184yhp.106.1410780379173; Mon, 15 Sep 2014 04:26:19 -0700 (PDT) Original-Received: from localhost.localdomain ([2601:0:a000:4a1:ee55:f9ff:feb5:5589]) by mx.google.com with ESMTPSA id 70sm5114283yhw.38.2014.09.15.04.26.18 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Sep 2014 04:26:18 -0700 (PDT) In-Reply-To: (Joost Kremers's message of "15 Sep 2014 11:18:44 GMT") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:4002:c07::22c 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:99911 Archived-At: That command would shrink the regexp and make it more efficient, but my goal here is to be able to more easily read and append to it, rather than optimize it. I would like to be able to have a list, maybe something like: ("^From:.*" ((".*@bulk1.com") (".*@bulk2.com") (".*@bulk3.com"))) I'm new enough to [e]lisp that I'm not sure what list->string concatenation functions would do the trick here. Joost Kremers writes: > Tory S. Anderson wrote: >> Using gnus I have a growing regexp that represents the criteria for bulk email and splits accordingly: > > [...] > >> Is there a way to clean this up to make it both more readable and more >> easily editable? It seems like keeping some kind of list would be the >> way to do it, instead of an ever-lengthening string. > > There's the function `regexp-opt', which takes a list of strings and > returns a regular expression that will match any of those strings. > Perhaps you can use that?