From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuri Khan Newsgroups: gmane.emacs.help Subject: Re: Use the characters "+" and "-" in regular expressions Date: Thu, 20 May 2021 02:30:22 +0700 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12355"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Skip Montanaro , Help Gnu Emacs To: steve-humphreys@gmx.com Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Wed May 19 21:51:46 2021 Return-path: Envelope-to: geh-help-gnu-emacs@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 1ljSEL-0002wc-Tk for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 19 May 2021 21:51:45 +0200 Original-Received: from localhost ([::1]:48780 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ljSEL-0000FY-0D for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 19 May 2021 15:51:45 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42728) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ljRtt-0006uC-Og for help-gnu-emacs@gnu.org; Wed, 19 May 2021 15:30:37 -0400 Original-Received: from mail-vk1-xa35.google.com ([2607:f8b0:4864:20::a35]:42981) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ljRtq-0004so-Oc for help-gnu-emacs@gnu.org; Wed, 19 May 2021 15:30:37 -0400 Original-Received: by mail-vk1-xa35.google.com with SMTP id m129so3008671vkh.9 for ; Wed, 19 May 2021 12:30:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=5hfMJ0v7f99YsGPz5jY3TWZZhb2eHHW11U4FQNR0eCk=; b=vJBHy6+upxnsV+bXkozf0lgEoyWjHxaWu52PtpqOCKONrakFb5aqaP0cy8TuBm9SDn PqYbS8nRyKhg1vjdqiIiOgODQBF5NXwAQrt+YjNZkcPE4DWjUmiE5vFbp6Jd2B7bTdrr cJNv83b9HwvVG97QoY28DMHcjTsmqGyNN0vIZWadtDdx89ojmj8dw3x5XfWuQYjMLoPs v3rgzd8o8n4Dy+4F6mHVaZmxjLpieZVbp+iWfxv/vzwmsSrHFahPrNItjPqE1ZlAT+ZX pv76qBALNftnQ0Xqs2moVYFI9USQUhUGIgp3BnyVYt4CQoRRn+4ZlRO9Dns8SZ89bSHS yrYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=5hfMJ0v7f99YsGPz5jY3TWZZhb2eHHW11U4FQNR0eCk=; b=oRYKnv2reqpIrBq+Ol2f7bksj2SdnIjFH3yqXn1sK4BL7k01UE9z6U45XrBbqDhSXM YPmXu+iKXLesiqI4KcSmTs52Kxh8gtuheKP/9zXzMXvEMhWows3EtYvT2u0HUNOEAwoN f+rBTOdHtQY+55jm9D2JZbQgZVujizbA1k0lZEHjjpRnvk/BOuZYPRgCMoprSqAV6E/D xfW+cAnPNqSleAzryYh+5auxRpd9krMmUyOqGW92Al9BSwMJ1sELgdga8eMhw6KBsKio MubJnUe8R/LLPStKTxSls+rZ9uWu+w4Mjp43H6yaXLQMGBxV9WuNKort1pbsahVBzUUP 67qA== X-Gm-Message-State: AOAM532u3endgXimeGS7HjHO1cROosOF/vPFGrwL7KQenz0TFXwxtdRe peDm1GhbMKxQxvbjXnAtlhHNCRKalUccGUduy9k= X-Google-Smtp-Source: ABdhPJy5z/XfRdDxKtsVkj7qxCiIexIFLfsE5cvlmyKlLq9pLJ+QxP84eBeY8nl7l9e9DmDXRnWLIx/ouX2eVyoNoYc= X-Received: by 2002:ac5:c3c4:: with SMTP id t4mr1297041vkk.13.1621452633832; Wed, 19 May 2021 12:30:33 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2607:f8b0:4864:20::a35; envelope-from=yurivkhan@gmail.com; helo=mail-vk1-xa35.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: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 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-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:129944 Archived-At: On Thu, 20 May 2021 at 00:39, wrote: > > I had tried > > (string-match " [-\+\.]+" s) This ought to work, even though you=E2=80=99re using backslashes incorrectl= y. * + and . are not special inside a character class; you don=E2=80=99t need = to escape them. * If you wanted to escape them in a regexp that is inside a string, you should have put two backslashes. * Escaping them with a single backslash only acts on the string syntax level; because + and . are not special in a string, they pass through as themselves so the regexp is the same as if you had written " [-+.]+". (string-match " [-+.]+" ";; ----") =E2=87=92 2 (string-match " [-+.]+" ";; ++++") =E2=87=92 2 (string-match " [-+.]+" ";; ....") =E2=87=92 2 (string-match " [-+.]+" ";; -+-+") =E2=87=92 2