Skip to main content

Questions tagged [query-replace-regexp]

Filter by
Sorted by
Tagged with
3 votes
2 answers
433 views

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" ...
pglpm's user avatar
  • 397
2 votes
0 answers
94 views

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, ...
Herman Nurlygayanov's user avatar
2 votes
1 answer
151 views

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 ...
Arch Stanton's user avatar
  • 1,856
1 vote
1 answer
134 views

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 ...
Schievel's user avatar
0 votes
1 answer
96 views

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....
147pm's user avatar
  • 3,085
0 votes
1 answer
108 views

I have this function: (defun my-replacements () (interactive) (query-replace "foo" "bar" nil (point-min) (point-max)) (query-replace "baz" "quz" nil (...
Gabriele's user avatar
  • 1,720
0 votes
1 answer
118 views

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 ...
Gabriele's user avatar
  • 1,720
0 votes
2 answers
130 views

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 < ~/....
vfclists's user avatar
  • 1,511
0 votes
1 answer
272 views

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 ~/....
vfclists's user avatar
  • 1,511
0 votes
2 answers
139 views

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 ...
vfclists's user avatar
  • 1,511
1 vote
1 answer
231 views

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....
pglpm's user avatar
  • 397
0 votes
2 answers
133 views

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 ...
a_subscriber's user avatar
  • 4,386
0 votes
1 answer
40 views

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-...
user avatar
0 votes
1 answer
122 views

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 ...
edman's user avatar
  • 1,281
0 votes
1 answer
39 views

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&...
edman's user avatar
  • 1,281
1 vote
1 answer
223 views

the title gives it all away: I want this 9874599842006432.08 To become this 9,874,599,842,006,432.08 with 1 single replace regexp operation and flexible, so that the same string also would work on a ...
starquake's user avatar
  • 107
2 votes
2 answers
123 views

I want to do simple replacements in a LaTeX source using something like that: ;; test-1 (query-replace-regexp (regexp-quote FOO) (concat "Foo " ...
Onner Irotsab's user avatar
0 votes
1 answer
180 views

I am terrible at remembering regular expression syntax. When replacing in by buffer with a regexp, I would like Emacs to highlight the possible matches while I am typing the regexp, so that I can see ...
Arthur Azevedo De Amorim's user avatar
0 votes
1 answer
142 views

I'm struggling with the basics of query-replace-regex after reading the manual. I'm trying to replace lots of citations formatted like this: #123213213, foo bar to #123213213\, foo bar the numbers ...
user13495873's user avatar
0 votes
1 answer
78 views

I'd like to write an elisp function that allows me to replace any line in my buffer matching a regex pattern <PATTERN> with text <TEXT>. In other words, if line N matches <PATTERN>, ...
Brian Fitzpatrick's user avatar
0 votes
1 answer
29 views

Over: \includepdf[pages={1-}]{example-image-a.pdf} I do / get M-x query-replace-regexp \\includepdf[pages={1-}]{.*} → \\includepdf[pages={1-}]{TEST} Replace 0 occurrences The problem comes from the ...
user avatar
0 votes
0 answers
43 views

What's the meaning of the error: Point 95406 after end of properties? I identified the piece of code that produces this error (blocking my script): ;; "Fig" --> "Figure" ;; &...
Gabriele's user avatar
  • 1,720
1 vote
1 answer
48 views

I have this function: (defvar biblio-publishers-info-list '(("Cambridge University Press" . "Cambridge, U.K.")) "DOCSTRING") (defun biblio-publishers-info-complete ()...
Gabriele's user avatar
  • 1,720
2 votes
1 answer
416 views

I'm looking for a solution to match two consecutive identical words except for the case of the initial characters with query-replace-regexp: The the the The I can't figure out how to match these ...
Onner Irotsab's user avatar
0 votes
1 answer
91 views

I would like to scan through a (latex) document and recursively delete -- WITH QUERY -- all consecutive, repeated words that need not be on the same line and/or the same case. Here is a simple ...
underflow's user avatar
  • 153
1 vote
2 answers
29 views

I'm trying to use replace-regexp to change the following code samples <- rep(10, 5)*1000 ## steps determined by samples * thin adaptive.ratio <- c(rep(c(1,0), 2), 0) ## Alternate between ...
mikemtnbikes's user avatar
0 votes
0 answers
170 views

It seems promising to have a built-in function that performs this action: find and replace all matching text recursively, within your project. The problem is that it doesn't seem consistent. I am ...
mcp's user avatar
  • 626
2 votes
2 answers
96 views

I should mention that I want to do this in emacs with its version of regex. Here's an example. I would like to change - \item - Property Agreement - Your agreement changing Joint ...
Byron Dom's user avatar
0 votes
1 answer
190 views

In a latex document, I wish to replace \cost(blah) with \cost{blah} in the entire document, where blah is an arbitrary string. That is, I only want to change the round brackets to curly brackets for ...
Vikram's user avatar
  • 347
0 votes
1 answer
276 views

I have a a bunch of HTML files and in each of them I want to replace a fixed block of approx 30 lines with a one liner. Is there an Emacs command or package which makes this easier? Using e.g. dired-...
halloleo's user avatar
  • 1,445
2 votes
1 answer
314 views

How do I make %s/x/y/gc use case insensitive matching but do case sensitive replaces? In emacs terms, I want case-fold-search but not case-replace.
HappyFace's user avatar
  • 930
0 votes
1 answer
95 views

How can I get GNU Emacs to automatically save all the files I've changed after doing a multi-file search/replace with query-replace-regexp? Right now I have to switch back to the buffer for every ...
cjg's user avatar
  • 1
1 vote
2 answers
538 views

I know, Emacs allows calling ELisp while replacing a text with a regex, aka C-M-%, which is bound to query-replace-regexp. I'm trying to make use of that to store an unwieldy regexp as a variable, so ...
Hi-Angel's user avatar
  • 1,292
3 votes
1 answer
129 views

How can I do the equivalent of query-replace-regexp for multiple regexps? For instance, if regexp1 is matched, it should be replaced by text1, and if regexp2 is matched, it should be replaced by text2 ...
vinc17's user avatar
  • 193
3 votes
2 answers
2k views

I am trying to use find-name-dired and query-replace-regexp to find and replace some blocks of text across multiple HTML files. (Just what is explained here in the Emacs Manual.) query-replace-regexp ...
zcal's user avatar
  • 31
2 votes
1 answer
64 views

Suppose I have a code base with many instances of string "console.log(" for example. I want to replace each one with one of the following six lines: logger(FATAL, logger(ERROR, logger(...
Ambrose's user avatar
  • 123
1 vote
1 answer
139 views

Say that I have rect1 one and I'll multiply it 3 times by yanking. let rect1 = Rectangle { width: 10, height: 40, } let rect1 = Rectangle { width: 10, height: 40, } ...
zoldseges's user avatar
1 vote
0 answers
65 views

I want to search and replace a block of text with a "query-like" approach all at once. For example, if I have \emph{``Foo $\bar$ baz''} to be replaced by \emph{Foo $\bar$ baz} using a &...
Onner Irotsab's user avatar
1 vote
1 answer
120 views

If I want to do a replace-regexp I usually start with a isearch-forward-regexp so I can get immediate visual feedback on the search string. From there I'd like to grab the search string for using in ...
Michael Terry's user avatar
0 votes
1 answer
42 views

This matches nothing: Query replace regexp (default \.org.+ → ): \.org.+$ → The same without '$' matches incompletely: I'd like to be able to match \.org and all that follows.
user avatar
0 votes
1 answer
181 views

Disclaimer: I'm still trying to learn elisp so I have not gotten yet to the RegExp section of the Elisp intro or Emacs manual. I would like to know how to search and replace an HTML buffer that has ...
avocadoras's user avatar
1 vote
1 answer
375 views

(defun my-find-orgfiles () (interactive) (find-name-dired "." "*py")) (global-set-key (kbd "M-n") 'my-find-orgfiles) Than, t to toggle marked/unmarked files (thus marking them all, since none ...
alper's user avatar
  • 1,570
0 votes
2 answers
156 views

I am running emacs 26.1 under linux. It has been working fine for over a year. Recently, I upgraded a lot of packages on my machine, but I did not upgrade nor alter emacs in any way. Now, query-...
HippoMan's user avatar
  • 656