From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Kangas Newsgroups: gmane.emacs.devel Subject: Re: Ugly regexps Date: Thu, 4 Mar 2021 12:35:58 -0600 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17866"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Stefan Monnier , emacs-devel@gnu.org To: Alan Mackenzie Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Mar 04 19:37:31 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lHsqp-0004Y7-Mg for ged-emacs-devel@m.gmane-mx.org; Thu, 04 Mar 2021 19:37:31 +0100 Original-Received: from localhost ([::1]:45508 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lHsqo-00086j-Nc for ged-emacs-devel@m.gmane-mx.org; Thu, 04 Mar 2021 13:37:30 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35738) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lHspO-0007GJ-9S for emacs-devel@gnu.org; Thu, 04 Mar 2021 13:36:02 -0500 Original-Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]:42546) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lHspM-0004Oh-Pd for emacs-devel@gnu.org; Thu, 04 Mar 2021 13:36:02 -0500 Original-Received: by mail-pl1-x62c.google.com with SMTP id s16so16638523plr.9 for ; Thu, 04 Mar 2021 10:36:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:in-reply-to:references:mime-version:date:message-id:subject:to :cc; bh=HdAIAbXagNWljsc3/I1IYpdkeEifPf+N+6B+jrgByFU=; b=XY0zq7Or0PZGwpv4PpIuXkCLp6BAbEj2NLvJxhZIhPF+533AXN9Qz5GDQPCt/VAy83 wPgp6oBwz5MJ0ztMfHVeBgkKkoxXIHg94garba9zpuoXwe0CnyxWiszrUQ7i0xY24WNO K3BjVE3FZFRze4QzxGQi8vA+KOeXj8fabr8/sP/zgbqjkxGy7PLEMiDaw6omPyR5deNI F5dQMGZnaIRTTs2SMyIUISdWSpPoAuEips4RTO83/4Spr9Wm41ysDdO3FiW63yiAUcxs H8nMkPug/WfWSwgwg/B4LQUDNR8vqyqUCSmhfyS2pRVk9jxnm2PlLHAYeUsLFp1bZ2O6 ktxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:in-reply-to:references:mime-version:date :message-id:subject:to:cc; bh=HdAIAbXagNWljsc3/I1IYpdkeEifPf+N+6B+jrgByFU=; b=ncdtEDT8tjEyx7O3HFO3jHVlg5YMUcxavVFvjsFB52wfbHr820BBANIZovbCJ1Bhii FUygExw6+GrJP1mfDv+A22LwMlzfHc1Is+btRyRiEETPyS+6HzpdoUMOEGN8eBuYFH5Q eTe2T6gSoW+ZVUYOx+dkmwc6x8G0VpXUzJ0wRQzOI6VABjvIaTQsaB2o4O2V3USgQMYS qDJ1SA84g8wse37zyttNUs3KV4E/yP8TEjm392QUTzKRU03VZzXlvgB128xJAle7lGTi f8ULSth1FrTCPo+pMRu7vshABRFAM9Om+oP5YCOB4dU5MJMlpMOaCmsdTx62A/xyywq3 fUsw== X-Gm-Message-State: AOAM5333y3FzL0yHvptM1rQCP4P9146WaOUtB7vTlYiWSxqivjAnDm68 MBt/chd/izAMhb7j+nBTJXtY5SNnH43SIxFTXqc= X-Google-Smtp-Source: ABdhPJwHUUMNJrmm4jfKThCxsEIAWYFM9GZXaRpvWTXIuV2LDxUAktpH/EKweMmCWVJdnswUUCR8wo9rr9JuiXtiKks= X-Received: by 2002:a17:90a:c249:: with SMTP id d9mr5989547pjx.104.1614882959375; Thu, 04 Mar 2021 10:35:59 -0800 (PST) Original-Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Thu, 4 Mar 2021 12:35:58 -0600 In-Reply-To: Received-SPF: pass client-ip=2607:f8b0:4864:20::62c; envelope-from=stefankangas@gmail.com; helo=mail-pl1-x62c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:265976 Archived-At: Alan Mackenzie writes: >> I was going to ask why not just do PCRE, but then I realized I'm not >> exactly sure what the syntactical differences are. (We obviously lack >> some features.) AFAIR, Emacs regexps don't exactly match GNU grep, >> egrep, Perl, or anything else really. > > These things don't exactly match eachother, do they? There is also a POSIX standard for BRE and ERE that we don't follow. My point is that we could match one of the above, even if they don't match each other. > The "biting" effect is surely small. I have little difficulty using > grep, egrep and awk, all of whose regexp notations differ somewhat. I am happy to hear that this works well for you. Two decades after writing my first regexp, I still tend to forget sometimes (oh wait is it \+ in sed again?). Then I have to look these stupid details up for the Nth time. > There's not a lot wrong with Emacs's regexp notation. It works, works > well, and we're all familiar with it. Of course it gets the job done in the sense that you can write a regexp that will match what you want. But it is overly verbose in common cases, making regexps harder than they need to be to read, understand and modify.