Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
Replacing is the action of searching a string for a sub-string and replacing it with a different string.
0
votes
1
answer
33
views
Replace a match only till some other match is found
(defun tdtoth ()
(if (search-forward "</tr>" nil t)
(while (search-forward "td" nil t)
(replace-match "th" 1))))
And executed it while I was on in the following text:
<tr>
<td> Some … text </td>
<td> Another thing </td>
</tr>
The idea being search for </tr> only once and while that is not happening, replace every td with th
But that code does not work. …
0
votes
1
answer
623
views
In elisp, search and replace only on lines containing a specific string
I need to search and replace only on lines containing a specific string.
Interactively, I use occur, move to the occur buffer, and do all search and replacement there. … "C" 1)))))
And used it on a buffer with:
AB
BB
CB
But it replaces all Bs with Cs whereas it should only replace AB with AC. …
1
vote
1
answer
434
views
Case-sensitive search and replace in elisp in spacemacs
class=\"nicelist\"\\)"
"\\1 type=\"A\"")
(xx-replace-regexp-and-return
"^[[:blank:]]\*LLI[[:space:]]\*\\(<[ou]l class=\"nicelist\"\\)"
"\\1 type=\"I\"")
(xx-replace-regexp-and-return … "\\)"
"\\1 type=\"i\"")))
(defun xx-replace-regexp-and-return (from to)
(save-excursion
(while (re-search-forward from nil t)
(replace-match to 1))))
The 1 in replace-to …
1
vote
Case-sensitive search and replace in elisp in spacemacs
The following change to xx-replace-regexp-and-return solves the problem:
(defun xx-replace-regexp-and-return (from to)
(let ((case-fold-search nil)))
(save-excursion
(while (re-search-forward … from nil t)
(replace-match to 1))))
The only change needed was to add (let ((case-fold-search nil))). …
3
votes
1
answer
660
views
Search and replace two consecutive newlines
Running spacemacs 0.200.
I am sorry if it is too basic. But I am just not able to get this.
How do I convert two consecutive newlines with some text, say, 'there were two newlines here'?
I could se …
1
vote
1
answer
376
views
Replace certain multibyte characters
(or replace-regexp or replace-string) these characters? … I mean, when it asks me to enter the string to replace, how do I enter \221 or \222, etc.? …