From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Skip Montanaro Newsgroups: gmane.emacs.help Subject: Re: Use the characters "+" and "-" in regular expressions Date: Wed, 19 May 2021 11:17:34 -0500 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="40780"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 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 18:19:02 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 1ljOuU-000AS4-37 for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 19 May 2021 18:19:02 +0200 Original-Received: from localhost ([::1]:39536 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ljOuT-0000qS-3p for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 19 May 2021 12:19:01 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57832) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ljOtK-0000nY-0y for help-gnu-emacs@gnu.org; Wed, 19 May 2021 12:17:50 -0400 Original-Received: from mail-yb1-xb2a.google.com ([2607:f8b0:4864:20::b2a]:45845) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ljOtI-0000Ni-9J for help-gnu-emacs@gnu.org; Wed, 19 May 2021 12:17:49 -0400 Original-Received: by mail-yb1-xb2a.google.com with SMTP id g38so18790006ybi.12 for ; Wed, 19 May 2021 09:17:47 -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; bh=jo3+ZJDo/CMsvTIzUEdpzki2M9NJkVR7FDVTy3GZNMs=; b=hK6CKyffS0iZjYXkrjxo1HHsRXQFikgpubeshaPcFVBnJwfeN7vyIS7Xi/IGOVmR29 K1urufUyqSRdOXvOpnkCHEBC3SKWz1Y5rJvsWqD2sBz56p4lU+3wwq1oDlJK/GK0xxiU TlGkjrvfcw4N6fI88P5UFJGsAtr8Jv/Jr+uSuuaaDy3J2A/weMGpME9dagOEA1w7PNIa NcrN7zx/zrJsTSgTLeGJmczCYHsSnSWDS5MeJNunWSmeODR8chjhiBd0XT1vJbQMNgvT My/MuEaPGG5WwC//2ON8wF9Hba7bYKtQ6DJqgOyEixNAOTBd7wQfgZ/qeXJaZdYQEXHC jFUA== 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; bh=jo3+ZJDo/CMsvTIzUEdpzki2M9NJkVR7FDVTy3GZNMs=; b=iGye1p1okloCufP26eyQr9FYBIq8hVQL+oIwN6oBGAyIanm/jlSRQ2DU8EOlQsGJ4U l8PTEx7fY5LZD0kPPMAesrm352zRA504TQKiYB+taYlOYUlLzpb3oo9PfFAs/1bdi2WJ oxt5ZQQ9P7aQ7ILhUFBjMxc3A4PbKbcEunNeKjAQaLRj+Vqp3gZhIewhl5onLzoO50mM ImPprvd/8/1wq/FFju6buEAVgEtmQQlBo3MOQejntvOXIbyQJiVdrWsnv1MbQjo0OKi9 xhR6KpGh2hcwSzOXmNARgiCI3RWV1cg7WI3Do4cTiD4S3c3I+lglOujthkbkMOqDbvoz Lugw== X-Gm-Message-State: AOAM531KfiM9jiexseTzVLuwDFLOOz2nhFjZw8dM7eC91x2MKKA3r4X0 4xxuvoMljfkrcAVKM+mvJGmjh/dyx0xyc39Fh2yYP5g= X-Google-Smtp-Source: ABdhPJzlrA7ZL7GO5uR1FHXfp4Ui1NkyDo24ym39vuqrFoICbimZZffdeBGxfqpsAqqFEHLttxGVOaNmAJnCGVm3yeE= X-Received: by 2002:a25:7b81:: with SMTP id w123mr318292ybc.429.1621441066452; Wed, 19 May 2021 09:17:46 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2607:f8b0:4864:20::b2a; envelope-from=skip.montanaro@gmail.com; helo=mail-yb1-xb2a.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, HTML_MESSAGE=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-Content-Filtered-By: Mailman/MimeDel 2.1.23 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:129931 Archived-At: > Is there a way to use the character "+" and "-" in regular expressions? > Yes, use character sets, e.g. [+] and [-]. If more characters are in a set along with a hyphen, that hyphen needs to be the first element of the set so as not to be interpreted as defining a range of characters. So, the character set containing 0, 9 and hyphen is [-09] or [-90], not [0-9], which would include all digits between 0 and 9, but not the hyphen. Skip >