help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: (newbie) search & replace (—match case) all at once without confirma


From: tomas
Subject: Re: (newbie) search & replace (—match case) all at once without confirmation automation
Date: Wed, 2 Nov 2022 18:35:38 +0100

On Wed, Nov 02, 2022 at 12:26:20PM +0000, jindam, vani wrote:
> hello emacs users,
> 
> after trying several gui text editors, i 
> hesistantly installed & familiarising emacs.
> so far, good. i have decided to use as default 
> text editor.
> 
> my search contains characters such as { or - or = 
> and alphabets. in other cli/gui editors, i choose 
> "match case" and "replace all".
> for example: "{{cite", "agree=yes"

By default, search is case insensitive (unless your search
string has mixed case).

To change that, you change the value of the variable `case-fold-search'
(try: M-x customize-variable, then `case-fold-search': you get a buffer
with a button where you can switch it on or off).

There are multiple other ways to achieve that, of course.

> straight to point:
> * where can i find examples for "search & replace 
> (—match case) all at once without confirmation"?
> * is it possible to use more than one for 
> search & replace? i mean, i want to replace 
> "{{cite", "agree=yes" at once?
> * if i cant use more than one, how do i automate?

Once you get your search-and-replace running, it will stop at the first
match. There you can type 'y' or just SPACE to effect the replacement,
'n' to skip to the next match. If you want to do "all the rest", you
just type '!'. There is a little message at the bottom of your edit
window which tells you that (and the other options you have).

That said, I'd recommend that you walk the extra mile and learn
"incremental search". For one you get immediate feedback while
you are entering your search string; then, you can pick up parts
of your buffer text to complete your search string. You can change
case sensitivity on the fly, change between regular expression and
literal string on the fly, too, and lastly, upgrade your search
to a search-and-replace.

Sounds complicated, but you don't have to learn everything at once.
It's woth it :)

Cheers
-- 
t

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]