From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.devel Subject: RE: rx.el sexp regexp syntax Date: Sun, 3 Jun 2018 12:57:57 -0700 (PDT) Message-ID: References: <87h8mw3yoc.fsf@gmail.com> <20180525155126.GA4096@ACM> <87lgc7hebk.fsf@gmail.com> <87r2lzd375.fsf@ericabrahamsen.net> <87lgbx2dc1.fsf@ericabrahamsen.net> <87in6z6gwa.fsf@ericabrahamsen.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1528055803 17522 195.159.176.226 (3 Jun 2018 19:56:43 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 3 Jun 2018 19:56:43 +0000 (UTC) To: Helmut Eller , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jun 03 21:56:38 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fPZ7G-0004QU-Km for ged-emacs-devel@m.gmane.org; Sun, 03 Jun 2018 21:56:38 +0200 Original-Received: from localhost ([::1]:36491 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fPZ9M-0008MQ-1W for ged-emacs-devel@m.gmane.org; Sun, 03 Jun 2018 15:58:48 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42407) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fPZ8j-0008M8-3y for emacs-devel@gnu.org; Sun, 03 Jun 2018 15:58:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fPZ8f-0005Zu-Vc for emacs-devel@gnu.org; Sun, 03 Jun 2018 15:58:09 -0400 Original-Received: from aserp2130.oracle.com ([141.146.126.79]:38794) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fPZ8f-0005ZO-Jt for emacs-devel@gnu.org; Sun, 03 Jun 2018 15:58:05 -0400 Original-Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w53JuK9R144654; Sun, 3 Jun 2018 19:58:02 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=mime-version : message-id : date : from : sender : to : subject : references : in-reply-to : content-type : content-transfer-encoding; s=corp-2017-10-26; bh=dgrA4k+cUPP/hOZQLKOiD7Th9b+LAyHhMlLccdcUsko=; b=HnS25nWFkHdPvrCpAwKb6iQ0ImxAMsrXdZUIQ5mDexsbu4KbTtjvQu7pcW4vdFKt3/b5 w6G/Z2rfaMYIAs86Pid+oJZjh0g3Z0N7wjI7kDgxZtKZldIGLVvCkKrpwvUUq4riwaTr XRdZCNevGfMPF6CyVNSAibVqlzp5M6/6epw1PGLg425AGpQteqv7cAJAZRDirgxBYQ2e YL3aB1+MnYc4WAKUaHfLRZt0YvgWFjZxwe1yc4rxjogjKwmrsm7DXls1eIbWXxagD2pb /3I5hNS6JkdZCcMGjDeCKe/7vtwxKm6NxVUiGd7sq24pPU10Hpz58/UUgqqbDBPVKqLK Rg== Original-Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by aserp2130.oracle.com with ESMTP id 2jbvynsbjp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 03 Jun 2018 19:58:02 +0000 Original-Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w53Jw1ct030650 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 3 Jun 2018 19:58:01 GMT Original-Received: from abhmp0017.oracle.com (abhmp0017.oracle.com [141.146.116.23]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w53Jw0bl022832; Sun, 3 Jun 2018 19:58:00 GMT In-Reply-To: X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 16.0.4690.0 (x86)] X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8913 signatures=668702 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=600 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1805220000 definitions=main-1806030248 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 141.146.126.79 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:225974 Archived-At: It's not just about confusion/obscurity due to the "extra" backslashes (for `(', `)', and `|'). It's also about the fact that regexps themselves can be complicated. For example, `directory-listing-before-filename-regexp': "\\([0-9][BkKMGTPEZY]? \\(\\([0-9][0-9][0-9][0-9]-\\)?[01][0-9]-[0-3][0-9][= T][ 0-2][0-9][:.][0-5][0-9]\\(:[0-6][0-9]\\([.,][0-9]+\\)?\\( ?[-+][0-2][0= -9][0-5][0-9]\\)?\\)?\\|[0-9][0-9][0-9][0-9]-[01][0-9]-[0-3][0-9]\\)\\|.*[0= -9][BkKMGTPEZY]? \\(\\(\\([A-Za-z']\\|[^\0-=7F]\\)\\([A-Za-z']\\|[^\0-=7F]\= \)+\\.? +[ 0-3][0-9]\\|[ 0-3][0-9]\\.? \\([A-Za-z']\\|[^\0-=7F]\\)\\([A-Za-= z']\\|[^\0-=7F]\\)+\\.?\\) +\\([ 0-2][0-9][:.][0-5][0-9]\\|[0-9][0-9][0-9][= 0-9]\\)\\|\\([A-Za-z']\\|[^\0-=7F]\\)\\([A-Za-z']\\|[^\0-=7F]\\)+\\.? +[ 0-= 3][0-9], +[0-9][0-9][0-9][0-9]\\|\\([ 0-1]?[0-9]\\([A-Za-z]\\|[^\0-=7F]\\)?= [ 0-3][0-9]\\([A-Za-z]\\|[^\0-=7F]\\)? +\\|[ 0-3][0-9] [ 0-1]?[0-9] +\\)\\= ([ 0-2][0-9][:.][0-5][0-9]\\|[0-9][0-9][0-9][0-9]\\([A-Za-z]\\|[^\0-=7F]\\)= ?\\)\\)\\) +" Even after removing "extra" backslashes, it's still a bear: "([0-9][BkKMGTPEZY]? (([0-9][0-9][0-9][0-9]-)?[01][0-9]-[0-3][0-9][ T][ 0-2= ][0-9][:.][0-5][0-9](:[0-6][0-9]([.,][0-9]+)?( ?[-+][0-2][0-9][0-5][0-9])?)= ?|[0-9][0-9][0-9][0-9]-[01][0-9]-[0-3][0-9])|.*[0-9][BkKMGTPEZY]? ((([A-Za-= z']|[^\0-=7F])([A-Za-z']|[^\0-=7F])+\\.? +[ 0-3][0-9]|[ 0-3][0-9]\\.? ([A-Z= a-z']|[^\0-=7F])([A-Za-z']|[^\0-=7F])+\\.?) +([ 0-2][0-9][:.][0-5][0-9]|[0-= 9][0-9][0-9][0-9])|([A-Za-z']|[^\0-=7F])([A-Za-z']|[^\0-=7F])+\\.? +[ 0-3][= 0-9], +[0-9][0-9][0-9][0-9]|([ 0-1]?[0-9]([A-Za-z]|[^\0-=7F])? [ 0-3][0-9](= [A-Za-z]|[^\0-=7F])? +|[ 0-3][0-9] [ 0-1]?[0-9] +)([ 0-2][0-9][:.][0-5][0-9= ]|[0-9][0-9][0-9][0-9]([A-Za-z]|[^\0-=7F])?))) +" As I said before: > Functions that transform a regexp string to an RX > sexp and vice versa would be very helpful. (And yes, the latter exists.) Ideally, we'd have the ability to put your cursor on a regexp in some code and hit a key to: * see a corresponding `rx' sexp and * optionally replace the regexp with the `rx' sexp. Just being able to see the `rx' sexp that corresponds to a regexp in some code (even temporarily in a popup) could help, I think.