2010-07-01から1ヶ月間の記事一覧

ファイル名の拡張を取り除く正規表現

たぶん preg_replace('/(\.[^.]+)$/', '', $f);

外部サイト判定?

"http://juice.com".match(/https?:\/\/([^\.]*\.?juice\.com)/); link_Href.search(/([a-z0-9]*\.ABCDE|^ABCDE)\.com/); "juice.com".match(/^[^\.]*\.?juice\.com/i); "juice.com".match(/^[^\.]*\.juice\.com/i); "juice.com".search(/^([^\.]*\.)?juice\…

javascript⇔phpのデコードエンコード

エンコード(js)encodeURIComponent → デコード(php)rawurldecode エンコード(php)rawurlencode → デコード(php)decodeURIComponent 参考:http://jsgt.org/ajax/ref/charset_test/responsetext/php/urlencode.php

.searchと.match

"http://ABCDE.com/".search(/^http:\/\/[0-9a-z]*.?ABCDE\.com/i);searchは検索位置を返します。ない場合は-1 "http://ABCDE.com/".match(/^http:\/\/[0-9a-z]*.?ABCDE\.com/i);matchは一致した文字列を返します。ない場合はnullです "<th>aisdiuauaa</th>".match(/<th>(</th>…