From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Add some aliases for re-related functions Date: Sat, 02 May 2020 18:49:44 -0400 Message-ID: References: <7976B8C1-AFC7-4662-B750-6492EB70C0D5@gmail.com> <1f156067-9bf3-e588-4306-9d673a2a27b9@yandex.ru> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="45572"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Yuan Fu , Emacs developers To: Dmitry Gutov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun May 03 00:56:18 2020 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 1jV13S-000BlM-JR for ged-emacs-devel@m.gmane-mx.org; Sun, 03 May 2020 00:56:18 +0200 Original-Received: from localhost ([::1]:42822 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jV13R-0007DW-Lt for ged-emacs-devel@m.gmane-mx.org; Sat, 02 May 2020 18:56:17 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53308) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jV0xC-0003cS-Nw for emacs-devel@gnu.org; Sat, 02 May 2020 18:49:51 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jV0xB-0002HT-Ix for emacs-devel@gnu.org; Sat, 02 May 2020 18:49:49 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:48454) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jV0xB-0002HK-2S for emacs-devel@gnu.org; Sat, 02 May 2020 18:49:49 -0400 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id B29A3450868; Sat, 2 May 2020 18:49:47 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 72880450852; Sat, 2 May 2020 18:49:46 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1588459786; bh=d5QP7AtwxcjkEi0/5UrVsz0hNf2FBHiCteKsRCCLrF4=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=BOyABkO8FLBXgi7cJp8+EOg44XmZ8bG4aYbd8dM8kavt+Pa2Ul2wQ9ghPKu85b7zC OZEtRmL10F3fhzWhPSnfveFd1ln4y8AHtvLg8ICeyxIm2ntPCfLT5KyUujbUDtwmmC hJ2dhneVqKVtofZ0fncJAPxUvtBDFI8CCnXkblocOJFPJ7C7ph+E4s2jm1zDNQa4e5 cMT1WvVTOQp1Ga321NOix/XE4XqQr2rK5s8qJl9NahFVOyuO4mccQlVSpIhDBvzkl/ toFbNlScRLAP/8mN63I7J0N5iYxyG+6XlT6ybzFQcgh4gzcJ9K7vqKrgtEIc8qPwlB xbGcX0KZ1zlAw== Original-Received: from alfajor (unknown [216.154.3.202]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 3C67C120611; Sat, 2 May 2020 18:49:46 -0400 (EDT) In-Reply-To: <1f156067-9bf3-e588-4306-9d673a2a27b9@yandex.ru> (Dmitry Gutov's message of "Sun, 3 May 2020 01:10:30 +0300") Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/02 16:40:06 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Received-From: 132.204.25.50 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:248604 Archived-At: >> [ I'm trying to use "search" and "match" in the way it's used in >> traditional regexp libraries. ] > Guess I'm unfamiliar with said libraries. I'd suggest re-looking-at and > re-looking-back (or whatever, like, don't create an alias for the last > one if we don't want to). Most of the literature on regular expressions concentrates on the problem of finding whether a given string matches a given regexp, where "matching" here means that the regexp matches the whole string. Think of it as the case where the regexp starts with \` and ends with \' Then there's the relaxation of "finding the longest match" (what we call `looking-at`) and then "finding the leftmost longest match" (what we call `string-match`). Those two have traditionally be named `re_match` and `re_search` respectively in C libraries (as can be seen in `src/regexp-emacs.c`). Stefan PS: BTW, `looking-back` doesn't do a "match" of the "longest match that ends at point" but a "search" for the "rightmost longest match that ends at point" since it uses `re-search-backward` internally.