unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Regular expressions and user-escaped characters
@ 2024-12-02 22:04 Christopher Howard
  2024-12-02 22:32 ` Joost Kremers
  2024-12-03 14:01 ` Stefan Monnier via Users list for the GNU Emacs text editor
  0 siblings, 2 replies; 5+ messages in thread
From: Christopher Howard @ 2024-12-02 22:04 UTC (permalink / raw)
  To: Help Gnu Emacs Mailing List

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

בראשית ברא אלהים את השמים ואת הארץ



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-12-03 14:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-02 22:04 Regular expressions and user-escaped characters Christopher Howard
2024-12-02 22:32 ` 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

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).