string mb_ereg_replace ( string $pattern , string $replacement , string $string [, string $option = "msr" ] )
string から pattern にマッチする文字列を探し、 見つかった文字列を replacement で置換します。
例1
$str= "dasfds\n\n\n\n\n\n";
$str = mb_ereg_replace("\n+$","\n",$str);
echo $str . "■";
例2
$work = mb_ereg_replace( "[ ]" , "" , $work , "m" );
参考
- http://php.net/manual/ja/function.mb-ereg-replace.php
WordNet
- put something back where it belongs; "replace the book on the shelf after you have finished reading it"; "please put the clean dishes back in the cabinet when you have washed them" (同)put back
- substitute a person or thing for (another that is broken or inefficient or lost or no longer working or yielding what is expected); "He replaced the old razor blade"; "We need to replace the secretary that left a month ago"; "the insurance will replace the lost income"; "This antique vase can never be replaced"
PrepTutorEJDIC
- (…として)…‘に'『取って代わる』《+『名』+『as』+『名』》 / (…と)…‘を'取り替える《+『名』+『with』(『by』)+『名』》 / …‘を'元の所に置く,戻す
- …の前に / …する前に,しないうちに(before)
- え‐,あの‐
UpToDate Contents
全文を閲覧するには購読必要です。 To read the full text you will need to subscribe.
Related Links
- If you want to replace characters like "ä" or "ø" you can use mb_ereg_replace, but it is very slow. str_replace is much faster and also works with characters like "ä" or "ø"! I think this has something to with the fact that str_replace ...
- パラメータ pattern 正規表現パターン。マルチバイト文字を使用できます。 大文字小文字は区別しません。 replace 置換する文字列。 string 検索対象となる文字列。 option option の意味は、 mb_ereg_replace() の場合と同じ ...
- で、この方法ではなく、”mb_ereg_replace ”を使用する事にした。 >mb_ereg_replace 更にこの関数を使用する直前に、 ”mb_convert_encoding”で文字コード変換を行う。 >mb_convert_encoding $str = mb_convert_encoding($str, 'EUC ...
★リンクテーブル★
[★]
PHP
マルチバイト文字の正規表現によるマッチをおこなう。
$body = '[[はは' . "\n" . 'はあは]] jfljfかs';
mb_ereg('^\[\[(.*?)\]\]', $body , $match );
正規表現のところはデリミタ不要なんですかね。つけると逆にうまくいかないから
- 関
- preg_match, preg_match_all
参考
- http://php.net/manual/ja/function.mb-ereg-match.php
[★]
- ~に取って代わる、~と交替する、~の後任になる。取り替える、入れ替える、交換する(by,with)
- もとのところに置く、戻す。返済する。復職/復位させる
- replace fluid 水分を補う
- 関
- displace, displacement, exchange, interchange, replacement, substitute, substitution, substitutional, swap
[★]
ミオグロビン myoglobin