正規表現
- 英
- regular expression
- 関
- [[]]
- 正規表現チェッカー
正規表現
- 特殊な記号:\\0, \\1
\\1:マッチした文字を表す
$ori = "聖徳太子は千円札だっけ?"; $target = "は(.*?)札"; $replace = "は五\\1札"; $str = mb_ereg_replace( $target, $replace, $ori ); echo $str;
実行結果
聖徳太子は五千円札だっけ?
\\1:マッチした文字を表す
$ori = "聖徳太子は千円札だっけ?"; $target = "は(.*?)札"; $replace = "は五\\1札"; $str = mb_ereg_replace( $target, $replace, $ori ); echo $str;
実行結果
聖徳太子は五千円札だっけ?