Timeline for Am I using "replace-regexp-in-string" the right way?
Current License: CC BY-SA 4.0
13 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Oct 27, 2023 at 10:21 | history | edited | vfclists | CC BY-SA 4.0 |
removed comments from example function
|
Oct 25, 2023 at 22:57 | answer | added | db48x | timeline score: 2 | |
Oct 25, 2023 at 22:51 | comment | added | db48x | You really need to edit it to specify exactly what your question is. Comments could end up getting deleted, in which case the question would be unclear. | |
Oct 25, 2023 at 20:05 | comment | added | vfclists | @NickD It looks like the replacement function has to apply the regex to the passed string again to a function that returns a list of the matched groups for it be useful. Is there a function for that? | |
Oct 25, 2023 at 19:42 | history | edited | vfclists | CC BY-SA 4.0 |
updated the question with a better explanation
|
Oct 25, 2023 at 19:34 | review | Close votes | |||
Nov 18, 2023 at 3:04 | |||||
Oct 25, 2023 at 19:30 | comment | added | NickD |
The \, syntax in replace-regexp only works when you call it interactively. There is no such facility for replace-regexp-in-string (it's not an interactive function, i.e. a command) but you can use a function, instead of a string, as the replacement. C-h f replace-regexp-in-string is, as always, your friend.
|
|
Oct 25, 2023 at 19:22 | comment | added | vfclists |
@Drew The first problem was I had to double the slashes in the regular expression. Now the problem is the \, syntax used in replace-regexp when the replacement is a lisp expression doesn't seem to work with replace-regexp-in-string
|
|
Oct 25, 2023 at 19:17 | history | edited | vfclists | CC BY-SA 4.0 |
escaped some slashes needed in the regex
|
Oct 25, 2023 at 19:14 | comment | added | Drew | The question needs to stand on its own. If something important needs to be added from some other question/answer, then include that here. | |
Oct 25, 2023 at 19:12 | comment | added | Drew | "scripting the solution" - The solution to what question/problem? and "it doesn't" [work] - What doesn't work? What does doesn't work mean here? The question isn't clear. | |
Oct 25, 2023 at 19:09 | history | edited | Drew | CC BY-SA 4.0 |
added 57 characters in body
|
Oct 25, 2023 at 18:22 | history | asked | vfclists | CC BY-SA 4.0 |