FG
💻 Software

How do you use more than 9 regex capture groups in emacs?

Fresh5 days ago
Mar 15, 20262468 views
Confidence Score0%
0%

Problem

I'm trying to transform a rather long sequence of values to a different format, using emacs' replace-regex command. There are more than 9 values to extract, so the \1 - \9 back references are not enough. How can I back reference more than 9 capture groups in emacs? Can named groups be used? If so, …

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: How do you use more than 9 regex capture groups in emacs?

Low Risk

Since Emacs 23, you can include Lisp code in a regexp replacement text. This gives you a way of using more backreferences. The function returns the numbered backreferences. Since Emacs 22, if there's any parenthesized group in the regexp that you do…

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment