From: Christopher Howard <christopher@librehacker.com>
To: Help Gnu Emacs Mailing List <help-gnu-emacs@gnu.org>
Subject: Regular expressions and user-escaped characters
Date: Mon, 02 Dec 2024 13:04:45 -0900 [thread overview]
Message-ID: <87plm9g2rm.fsf@librehacker.com> (raw)
Hi, what do you do in a regular expression if you want to match a character, but not a the same character that has been escaped by the user. E.g., if I want my regular expression to look for ?\[ (ASCII 91), matching string "[" and "a[a" but not string "\\[" or "a\\[a", if you follow me. Is this possible with just a regular expression?
If not, what is a good workaround? I was wondering about, say, replacing all the escaped characters first with some uncommon character (like a control code) and then converting back afterwards. But then I suppose I would need to do a check for that uncommon character first.
--
📛 Christopher Howard
🚀 gemini://gem.librehacker.com
🌐 http://gem.librehacker.com
בראשית ברא אלהים את השמים ואת הארץ
next reply other threads:[~2024-12-02 22:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-02 22:04 Christopher Howard [this message]
2024-12-02 22:32 ` Regular expressions and user-escaped characters Joost Kremers
2024-12-02 22:50 ` Joost Kremers
2024-12-02 23:09 ` Joost Kremers
2024-12-03 14:01 ` Stefan Monnier via Users list for the GNU Emacs text editor
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=87plm9g2rm.fsf@librehacker.com \
--to=christopher@librehacker.com \
--cc=help-gnu-emacs@gnu.org \
/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).