๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

4 total messages Started by SHIIBA Michiharu Sat, 22 Jun 2002 10:14
how to replace aa_bcd with aaBcd
#235
Author: SHIIBA Michiharu
Date: Sat, 22 Jun 2002 10:14
27 lines
1465 bytes
$BDGMU$H8@$$$^$9!#(B

query-replace-regexp $B$K4X$9$k<ALd$G$9!#(B

(defun foo ()
  (interactive)
  (query-replace-regexp "\\(\\w\\)_\\(\\w\\)" "\\1\\2")))

$B$N$h$&$J4X?t$rMQ0U$7$F<B9T$9$k$3$H$K$h$j!"%P%C%U%!Fb$K$"$k(B

  aa_bcd, foo_bar

$B$N$h$&$JJ8;zNs$r(B

  aabcd, foobar

$B$K$G$-$^$9$,!"F1;~$K(B _ $B$N8e$N(B1$BJ8;z$rBgJ8;z$KJQ49$7$F(B

  aaBcd, fooBar

$B$N$h$&$K$J$k$h$&$K$9$k$K$O!"@h$N4X?t(B foo $B$r$I$N$h$&$K=q$-JQ$($l$P(B
$B$h$$$G$7$g$&$+!#(B

$B$h$m$7$/$*4j$$$7$^$9!#(B  

-- 
$BDGMU(B $B=<@2(B (Michiharu CBAR)
Re: how to replace aa_bcd with aaBcd
#236
Author: Katsumi Yamaoka
Date: Thu, 27 Jun 2002 01:57
31 lines
2343 bytes
>>>>> In <x5u1nvy616.fsf@civilnet.kuciv.kyoto-u.ac.jp>
>>>>>	SHIIBA Michiharu <shiiba@civilnet.kuciv.kyoto-u.ac.jp> wrote:

ๆคŽ่‘‰ใ•ใ‚“> query-replace-regexp ใซ้–ขใ™ใ‚‹่ณชๅ•ใงใ™ใ€‚

ๆคŽ่‘‰ใ•ใ‚“> (defun foo ()
ๆคŽ่‘‰ใ•ใ‚“>   (interactive)
ๆคŽ่‘‰ใ•ใ‚“>   (query-replace-regexp "\\(\\w\\)_\\(\\w\\)" "\\1\\2")))

[...]

ๆคŽ่‘‰ใ•ใ‚“>   aaBcd, fooBar

ๆคŽ่‘‰ใ•ใ‚“> ใฎใ‚ˆใ†ใซใชใ‚‹ใ‚ˆใ†ใซใ™ใ‚‹ใซใฏใ€ๅ…ˆใฎ้–ขๆ•ฐ foo ใ‚’ใฉใฎใ‚ˆใ†ใซๆ›ธใๅค‰
ๆคŽ่‘‰ใ•ใ‚“> ใˆใ‚Œใฐใ‚ˆใ„ใงใ—ใ‚‡ใ†ใ‹ใ€‚

query-replace-regexp ใ ใ‘ใงใฏใŸใถใ‚“็„ก็†ใงใ™ใ€‚ใ“ใ‚“ใชๆ„Ÿใ˜ใงใ—ใ‚‡ใ†ใ‹?

(defun foo2 ()
  (interactive)
  (let (old new)
    (while (re-search-forward "\\(\\w+\\)_\\(\\w+\\)" nil t)
      (setq old (match-string 0)
	    new (concat (match-string 1)
			(capitalize (match-string 2))))
      (if (y-or-n-p (concat "Query replacing \"" old
			    "\" with \"" new "\" "))
	  (replace-match new)))
    (message "done")))
-- 
ๅฑฑๅฒก
Re: how to replace aa_bcd with aaBcd
#237
Author: SHIIBA Michiharu
Date: Mon, 01 Jul 2002 02:30
32 lines
1906 bytes
$B;32,MM(B

$B$"$j$,$H$&$4$6$$$^$7$?!#(B

$B;32,MM(B> query-replace-regexp $B$@$1$G$O$?$V$sL5M}$G$9!#$3$s$J46$8$G$7$g$&$+(B?

$B;32,MM(B> (defun foo2 ()
$B;32,MM(B>   (interactive)
$B;32,MM(B>   (let (old new)
$B;32,MM(B>     (while (re-search-forward "\\(\\w+\\)_\\(\\w+\\)" nil t)
$B;32,MM(B>       (setq old (match-string 0)
$B;32,MM(B> 	    new (concat (match-string 1)
$B;32,MM(B> 			(capitalize (match-string 2))))
$B;32,MM(B>       (if (y-or-n-p (concat "Query replacing \"" old
$B;32,MM(B> 			    "\" with \"" new "\" "))
$B;32,MM(B> 	  (replace-match new)))
$B;32,MM(B>     (message "done")))

foo_bar_aho $B$J$I$KBP1~$9$k$?$a$K!"(B

	  (replace-match new)

$B$r(B
          (progn
  	    (replace-match new)
            (backward-char 1))

$B$H$7$F;H$&$3$H$K$7$^$7$?!#$I$&$b$"$j$,$H$&$4$6$$$^$7$?!#(B            


-- 
$BDGMU(B $B=<@2(B (Michiharu CBAR)
Re: how to replace aa_bcd with aaBcd
#238
Author: Keiichi Suzuki
Date: Mon, 01 Jul 2002 07:57
29 lines
2378 bytes
>>>>> Message-Id: <x5hejkch8a.fsf@civilnet.kuciv.kyoto-u.ac.jp> ใฎ่จ˜ไบ‹ใงใ€
>>>>> "ๆคŽ่‘‰" == SHIIBA Michiharu <shiiba@civilnet.kuciv.kyoto-u.ac.jp>ใ•ใพๆ›ฐใ...

(defun y-or-n-p-with-replace-highlight (beg end form &rest args)
  (unwind-protect
      (progn
	(pop-to-buffer (current-buffer))
	(replace-highlight beg end)
	(y-or-n-p (apply 'format form args)))
    (replace-dehighlight)))

ไฝ•ใฆใ‚‚ใฎใ‚’ใ‚ใ‚‰ใ‹ใ˜ใ‚ๅฎš็พฉใ—ใฆใŠใ„ใฆ

ๅฑฑๅฒกๆง˜> (if (y-or-n-p (concat "Query replacing \"" old
ๅฑฑๅฒกๆง˜> "\" with \"" new "\" "))

.ใฎไปฃใ‚Šใซ

(if (y-or-n-p-with-replace-highlight
     (match-beginning 0) (match-end 0)
     "Quely replaceing \"%s\" with \"%s\" "
     old new)

ใชใฉใจใ™ใ‚‹ใจใกใ‚‡ใฃใจใ ใ‘ๅนธใ›ใ‹ใ‚‚็Ÿฅใ‚Œใพใ›ใ‚“ใ€‚

-- 
้ˆดๆœจๅœญไธ€ / keiichi@nanap.org
PGP finger print (DH/DSS)
0B32 B37E 6DE9 3BC1 68A4  4089 7AAF 2B03 ECBD 614B
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads