Next: Substr, Previous: Index, Up: Text handling [Contents][Index]
Àµµ¬É½¸½¤Î¸¡º÷¤ÏÁȤ߹þ¤ß¥Þ¥¯¥íregexp
¤Ç¹Ô¤¤¤Þ¤¹¡£
regexp(string, regexp, opt replacement)
¤³¤Î¥Þ¥¯¥í¤Ïregexp¤Çstring¤ÎÃæ¤ò¸¡º÷¤·¤Þ¤¹¡£ Àµµ¬É½¸½¤Î¹½Ê¸¤ÏGNU Emacs¤Î¤â¤Î¤ÈƱ¤¸¤Ç¤¹¡£ See Syntax of Regular Expressions in The GNU Emacs Manual.
replacement¤ò¾Êά¤¹¤ë¤È¡¢regexp
¤Ïstring¤ÎÃæ¤Ç
regexp¤ËºÇ½é¤Ë¥Þ¥Ã¥Á¤·¤¿Éôʬ¤Î¥¤¥ó¥Ç¥Ã¥¯¥¹¤ËŸ³«¤µ¤ì¤Þ¤¹¡£
regexp¤¬string¤Î¤É¤³¤Ë¤â¥Þ¥Ã¥Á¤·¤Ê¤¤¾ì¹ç¤Ï-1¤ËŸ³«¤µ¤ì¤Þ¤¹¡£
regexp(`GNUs not Unix', `\<[a-z]\w+') ⇒5 regexp(`GNUs not Unix', `\<Q\w*') ⇒-1
replacement¤òÍ¿¤¨¤¿¤È¤¤Ï¡¢regexp
¤Ï¤³¤Î°ú¿ô¤ÎÃͤËŸ³«¤µ¤ì¤Þ¤¹¡£
¤³¤Î¤È¤replacement¤Ë´Þ¤Þ¤ì¤ë‘\n’¤ÏregexpÃæ¤Î
nÈÖÌܤΥ«¥Ã¥³¤Ç¤¯¤¯¤é¤ì¤¿Éôʬ¼°¤Ë¥Þ¥Ã¥Á¤·¤¿¥Æ¥¥¹¥È¤ËÃÖ¤´¹¤¨¤é¤ì¡¢
‘\&’¤ÏÀµµ¬É½¸½Á´ÂΤ˥ޥåÁ¤·¤¿¥Æ¥¥¹¥È¤ËÃÖ¤´¹¤¨¤é¤ì¤Þ¤¹¡£
regexp(`GNUs not Unix', `\w\(\w+\)$', `*** \& *** \1 ***') ⇒*** Unix *** nix ***
ÁȤ߹þ¤ß¥Þ¥¯¥íregexp
¤Ï°ú¿ô¤òÍ¿¤¨¤¿¤È¤¤À¤±Ç§¼±¤µ¤ì¤Þ¤¹¡£