PHP常用正則

2014 ワード

//検証中国語^[u 4 e 00-u 9 fa 5]{0,}$
//数字、26文字の英字または下線からなる文字列^w+$
//E-Mailアドレスをチェック[w!#$%&'+/?^_{|}~-]+(?:\\.[\\w!#$%&'*+/=?^_{|}~-]+)@(?:w?.)+\w?
//身分証明書番号の検証//15位:^[1-9]d{7}((0d)|(1[0-2]))([0|1|2]d)|3[0-1])d{3}$//18位:^[1-9]d{5}[1-9]d{3}((0d)|(1[0-2]))))(([0|1|2]d)|3[0-1])d{3}([0-9]|X)$
//////////////"yyyyy-mm-dd"形式の日付検証は、平閏年^(?:(?!?!?!?!?!?!?!?[0][0-9]{4}-(?:(?:0[1-9]|1[0-9]|1[0-9]|1[0-9]|2[0[0-8]|(?:0[13-9]|1[0[0-2])-(?:29|30)|(?:0[13578]|1[0]|1[02]-31|(?:[0-9]{2}(?:0[48]|[2468][048]|[133579][26]]|||[133579][26]])|||(?(?:::::(?:0[48]|[2468][048]|[13579][26])00)-02-29)$
//判断IEのバージョン^.MSIE 5-8?(?!.Trident/[5-9].0).*$
//IP-v 4アドレスb(?:(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b
IP-v 6アドレスの検証(([0-9 a-fA-F]{1,4}:){7,7}[0-9 a-fA-F]{1,4}|([0-9 a-fA-F]{1,4}:){1,7,7}{0,7}[0-9 a-fA-F]{1,4}:{1,6}:[0-9 a-fA-F]{1,4}|([0-9 a-fA-F]{1,4}|([0-9 a-fA-F]{1,4}:){1,2}|([0-9 a-fA-F]{1,4}:){1,1,4}:){1,1,4}(::fA-F]{1,4}){1,3}|([0-9 a-fA-F]{1,4}:){1,3}(:[0-9 a-fA-F]{1,4}){1,4}|([0-9 a-fA-F]{1,4}:){1,2}(:[0-9 a-fA-F]{1,4}){1,5}|[0-9 a-fA-F]{1,4}:((::[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))
//URLの接頭辞if(!s.match(/^[a-zA-Z]+:///){s='http://s'+s;}
//ファイルパスおよび拡張子チェック([a-zA-Z]:|\)\([\]+\)[^/:?"<>|]+.txt(l)?$;
//Webページの画像を抽出<[img][^\>][src]*=[']{0,1}([^]'>])
//ページハイパーリンクの抽出((?!.\brel=)[^>])(href="https?:\/\/)((?!(?:(?:www\.)?'.implode('|(?:www\.)?', $follow_list).'))[^"]+)"((?!.\brel=)[>]*)(?:[>]*)>)
HTMLタグ=s(?:".?"|'.?'|[^'">s]+)?)+s|s)/?>
?>