使用者工具

網站工具


editor:regular_expression

差異處

這裏顯示兩個版本的差異處。

連向這個比對檢視

下次修改
前次修改
editor:regular_expression [2006/11/16 03:29] – 建立 wenpeieditor:regular_expression [2015/07/12 22:05] (目前版本) – [Visualize tool] sars
行 1: 行 1:
 ====== 正規表示式 ====== ====== 正規表示式 ======
 +{{:editor:regular-expressions-cheat-sheet-v2.png|}}
 +
 +===== Regular Expression Library =====
 +http://regexlib.com/
 +
 +===== Visualize tool =====
 +  * http://www.regexper.com/
 +  * https://www.regex101.com/
 +===== 基礎寫法 =====
 ^  Char  ^  ^ ^  Char  ^  ^
 |  .  |任何單一字元| |  .  |任何單一字元|
行 18: 行 27:
 ==== Example ==== ==== Example ====
   ^$  空白行   ^$  空白行
 +
 +====== Regular Expression in PHP ======
 +http://cckk.tw/wordpress/archives/2006/07/18/52/
 +
 +^  expression  ^  function  ^
 +|  [a-zA-Z]{0,6}  |字串由六個以內的英文字母組成|
 +|  [a-z]  |一定範圍的文字可以使用”-”來作連結|
 +|  ([a-z]\.)+  |a.b.c.d.|
 +|  . \ * +  |需要跳脫字元|
 +|  [:alnum:]  |[a-zA-Z0-9]|
 +|  [:alpha:]  |[a-zA-Z]|
 +|  [:blank:]  |空白|
 +|  [:digit:]  |數字|
 +|  [:lower:]  |小寫|
 +|  [:upper:]  |大寫|
 +|  {起始,結束}  |範圍內的表達式|
 +|  {0,}  |0個或更多|
 +|  {,6}  |六個以下|
 +|  {3}  |三個|
 +|  [0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}  |IP|
 +|  09[0-9]{2}-[0-9]{3}-[0-9]{3}  |手機|
 +|  [a-zA-Z0-9\._\+]+@([a-zA-Z0-9\.-]\.)*[a-zA-Z0-9\.-]+  |E-Mail|
 +
 +  ereg(正規表達式, 字串 [, 結果矩陣]);
 +  eregi(正規表達式, 字串 [, 結果矩陣]);    // 不區分大小寫
 +
 +====== 37 Tested PHP, Perl, and JavaScript Regular Expressions ======
 +http://www.virtuosimedia.com/tutorials/37-tested-php-perl-and-javascript-regular-expressions
 +
editor/regular_expression.1163618950.txt.gz · 上一次變更: (外部編輯)