From: Drew Adams <drew.adams@oracle.com>
To: "steve-humphreys@gmx.com" <steve-humphreys@gmx.com>,
Help Gnu Emacs <help-gnu-emacs@gnu.org>
Subject: RE: [External] : Use the characters "+" and "-" in regular expressions
Date: Wed, 19 May 2021 19:17:08 +0000 [thread overview]
Message-ID: <SA2PR10MB4474688064973CA55F7ED5A5F32B9@SA2PR10MB4474.namprd10.prod.outlook.com> (raw)
In-Reply-To: <trinity-76ea1199-ca84-4953-91f4-48e19f225d98-1621440445355@3c-app-mailcom-bs08>
> Is there a way to use the character "+" and "-" in regular expressions?
Ask Emacs!
1. `C-h i' Choose Elisp manual.
2. `i regexp TAB', and complete to
`regexp, special characters in'
3. Read about `\':
it quotes the special characters
Because ‘\’ quotes special characters, ‘\$’ is a
regular expression that matches only ‘$’, and ‘\[’ is
a regular expression that matches only ‘[’, and so on.
IOW, `\+' and `\-' match (only) `+' and `-', respectively.
Another way to match special chars literally is to include
them in a character alternative, also described in the same
page of the manual.
`[+]' matches only `+', `[-]' matches only `+' or `-', and
`[-+]' and `[+-]' match either `+' or `-'.
Note too that `-' in a char alternative behaves specially:
To include a ‘-’, write ‘-’ as the first or last
character of the character alternative, or as the
upper bound of a range. Thus, ‘[]-]’ matches both
‘]’ and ‘-’.
In `[-+]' and `[+-]', the `-' is the first or last char in
the alternative.
prev parent reply other threads:[~2021-05-19 19:17 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-19 16:07 Use the characters "+" and "-" in regular expressions steve-humphreys
2021-05-19 16:17 ` Skip Montanaro
2021-05-19 16:26 ` steve-humphreys
2021-05-19 16:47 ` Yuri Khan
2021-05-19 17:39 ` steve-humphreys
2021-05-19 19:16 ` tomas
2021-05-19 19:27 ` tomas
2021-05-19 19:30 ` Yuri Khan
2021-05-19 21:32 ` tomas
2021-05-19 21:59 ` [External] : " Drew Adams
2021-05-20 6:26 ` RE: [External] : " steve-humphreys
2021-05-20 7:59 ` steve-humphreys
2021-05-20 8:26 ` tomas
2021-05-20 8:41 ` steve-humphreys
2021-05-20 9:42 ` steve-humphreys
2021-05-20 9:56 ` tomas
2021-05-20 10:11 ` steve-humphreys
2021-05-20 10:22 ` tomas
2021-05-20 10:37 ` steve-humphreys
2021-05-20 10:50 ` tomas
2021-05-20 11:19 ` steve-humphreys
2021-05-20 11:27 ` steve-humphreys
2021-05-20 12:04 ` tomas
2021-05-20 11:31 ` Christopher Dimech
2021-05-20 11:40 ` steve-humphreys
2021-05-20 11:49 ` Christopher Dimech
2021-05-20 13:03 ` Jean Louis
2021-05-20 11:59 ` tomas
2021-05-20 12:53 ` Jean Louis
2021-05-20 12:46 ` Jean Louis
2021-05-20 13:55 ` steve-humphreys
2021-05-20 14:14 ` Jean Louis
2021-05-20 14:28 ` steve-humphreys
2021-05-20 16:24 ` Yuri Khan
2021-05-20 16:34 ` steve-humphreys
2021-05-20 17:16 ` Eduardo Ochs
2021-05-20 18:29 ` Drew Adams
2021-05-21 5:48 ` Jean Louis
2021-05-20 12:39 ` Jean Louis
2021-05-20 7:15 ` Dash in regexp character classes: Beginnig vs. end [was: Use the characters "+" and "-" in regular expressions] tomas
2021-05-20 8:08 ` Robert Pluim
2021-05-19 19:26 ` [External] : Re: Use the characters "+" and "-" in regular expressions Drew Adams
2021-05-19 19:25 ` Drew Adams
2021-05-19 16:27 ` tomas
2021-05-19 16:39 ` Skip Montanaro
2021-05-19 17:43 ` Marcin Borkowski
2021-05-19 19:10 ` tomas
2021-05-19 19:17 ` Drew Adams [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=SA2PR10MB4474688064973CA55F7ED5A5F32B9@SA2PR10MB4474.namprd10.prod.outlook.com \
--to=drew.adams@oracle.com \
--cc=help-gnu-emacs@gnu.org \
--cc=steve-humphreys@gmx.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).