PHP
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

POSIX 正規表現関数> <定義済み定数
Last updated: Fri, 04 Jul 2008

view this page in

例1 正規表現の例

<?php
// "abc" が $string のどこかにある場合に true を返す
ereg("abc"$string);            

// "abc" が $string の最初にある場合に true を返す
ereg("^abc"$string);

// "abc" が $string の最後にある場合に true を返す
ereg("abc$"$string);

// クライアントブラウザがNetscape 2, 3またはMSIE 3である場合にtrue を返す
eregi("(ozilla.[23]|MSIE.3)"$_SERVER["HTTP_USER_AGENT"]);

// 空白で区切られた3つ単語を
// $regs[1], $regs[2],$regs[3]に代入する
ereg("([[:alnum:]]+) ([[:alnum:]]+) ([[:alnum:]]+)"$string$regs); 

// <br /> タグを $string の先頭に挿入する
$string ereg_replace("^""<br />"$string); 

// <br /> タグを $string の最後に挿入する
$string ereg_replace("$""<br />"$string); 

// $string の改行文字を全て取り除く
$string ereg_replace("\n"""$string);
?>



add a note add a note User Contributed Notes
There are no user contributed notes for this page.

POSIX 正規表現関数> <定義済み定数
Last updated: Fri, 04 Jul 2008
 
 
show source | credits | sitemap | contact | advertising | mirror sites