Questions tagged [query-replace-regexp]
The query-replace-regexp tag has no summary.
43 questions
3
votes
2
answers
448
views
How to replace any letter with the next in the alphabet?
It's Emacs, so I'm sure it's possible to do a query-replace-regexp that replaces any [a-zA-Z] letter with the following one in the alphabet, at least for ASCII letters. So for instance "sgd" ...
2
votes
0
answers
101
views
How to do multi-line regex replace across multiple files?
What I want
A convenient way (with preview, interactivity) to replace regex multi-line matches across many files
What I already have
I know how to do this for single-line matches. I use counsel-rg, ...
2
votes
1
answer
158
views
Make non-regexp searches always case insensitive and regexp searches always case sensitive
I'd like my fixed-string searches to be always case insensitive, my regexp searches to be always case sensitive, and I don't want search-upper-case to change the case of my search strings. This should ...
1
vote
1
answer
140
views
How to call query-replace-regexp in elisp with capture groups and functions in replacement string
I want to write a few functions that call query-replace-regexp with regex and replacement strings that are too complicated to remember and to hard to figure them out again every time I need them.
For ...
0
votes
1
answer
109
views
How to replace-regexp text to the head of an org-mode paragraph
M-x replace-regexp RET ^ RET your text RET will add "your text" to the start of every line of an emacs buffer, but how could I do the same to the start of every org-mode paragraph instead, i....
0
votes
1
answer
112
views
query-replace: ignore events not binded in query-replace-map
I have this function:
(defun my-replacements ()
(interactive)
(query-replace "foo" "bar" nil (point-min) (point-max))
(query-replace "baz" "quz" nil (...
0
votes
1
answer
126
views
query-replace bug?
When I run query-replace* commands if I type ? I get this explanation of the function's options:
Type Space or ‘y’ to replace one match, Delete or ‘n’ to skip to next,
RET or ‘q’ to exit, Period to ...
0
votes
2
answers
142
views
How can a regex replace that computes the replacement in a function using back references be converted to a CLI batch version processing line by line?
An example of this is a script to output the contents of .zsh_history file in the manner of the history command, so an emacs script would be invoked by a command line like display.sh.el < ~/....
0
votes
1
answer
282
views
Am I using "replace-regexp-in-string" the right way?
I want to view ~/.zsh_history files the way they are displayed by the history command with raw unixtimestamps converted to properly formatted dates.
: 1568128379:0;cp -a ~/.zshrc.pre-oh-my-zsh ~/....
0
votes
2
answers
148
views
Is it possible for a query-replace-regexp to replace the value with a computed value?
I want to convert the timestamps in a .zsh_history file to their readable equivalents.
Does query-replace-regex or some other function provide the ability to replace the match with the value of a ...
1
vote
1
answer
240
views
Function to replace strings from region and save result in kill-ring
I'm almost completely ignorant in elisp, but I'd like to have a function that does the following:
Takes a string from (a) a region, if one is selected, or (b) user prompt, if a region is not selected....
0
votes
2
answers
139
views
How can I interactively replace text in all files in all subfolders?
Emacs 27.1
Linux Mint 21
I have text modifyNetwork in 50 files in differents folders. I need to replace them by text performCommand.
What is the easiest way to replace text in all files in all ...
0
votes
1
answer
42
views
Regexp for first consecutive non whitespace ending with @?
I have a mailing list whose lines contain garbage characterized by spaces, like this:
bar qux [email protected]
for which I want to extract [email protected]. I tried this unsuccessfully:
M-x query-replace-...
0
votes
1
answer
128
views
isearch-forward-regex does not find a regex found by re-builder
I wanted to create a regex to find these dates:
1966/08/20
2023/02/12
In re-builder I was able to build this:
"\([0-9]\{4\}\)/\([0-9]\{2\}\)/\([0-9]\{2\}\)"
In the buffer the dates are ...
0
votes
1
answer
40
views
Efficient way to change the format of a date in orgmode
enter code hereWhat would be the most efficient way to change the format of a list of dates like this in Emacs:
|Bob|1966/08/20|2023/05/19|
|Janice|1964/09/18|2023/05/19|
To this:
|Bob|<1966-08-20&...