ドットインストール代表のライフハックブログ
![IDEA * IDEA](https://cdn-ak-scissors.b.st-hatena.com/image/square/d5ea53f8dec5c1b92abb8ce3147d65eb4d90ec94/height=288;version=1;width=512/http%3A%2F%2Fwww.ideaxidea.com%2Fwp-content%2Fuploads%2F2013%2F08%2FStop-writing-Regular-Expressions.-Express-them-with-Verbal-Expressions.-The-Changelog.png)
Shibuya.pm #16 「夏の正規表現祭り」で、正規表現のお話をさせていただきました。 まぁ、「電話番号にマッチする正規表現」とか「郵便番号にマッチする正規表現」とかよく書かれてるけど、「どれもこれも手緩いよね」って話。 あ、だいぶはしょったかな。 とりあえずスライドに書いたので、発表をご覧になってない方はスライドからご覧ください。 ふと見返すと、このブログで電話番号の正規表現を公表するのは 3 度目ですが、あれからだいぶ経ってますね。 今ではもっと厳密な正規表現を作っています。 そして、Number::Phone::JP に続き、Number::ZipCode::JP という酔狂なモジュールが公開された記念で、郵便番号にマッチする正規表現を今回初めて公開しますが、そもそもここまで厳密な正規表現が公開されること自体、本邦初公開ってヤツでしょう。 Shibuya.pm でも言いましたが
追記 os0xさんにjson2.jsで使われている手法である事を教えてもらいました。 正しくはエスケープが必要。 以下フォーラムで議論されている内容から拝借 validating json unnecessarily is killing firefox - jQuery Forum // Try to use the native JSON parser first if (window.JSON && window.JSON.parse) { try { return window.JSON.parse( data ); } catch (err) { jQuery.error( "Invalid JSON: " + data ); } } else { if ( /^[\],:{}\s]*$/.test(data.replace(/\\(?:["\\\/bfnrt]|u[0-9a-f
This is the source code repository for RE2, a regular expression library. For documentation about how to install and use RE2, visit https://github.com/google/re2/. The short version is: make make test make install make testinstall Building RE2 requires Abseil (https://github.com/abseil/abseil-cpp) to be installed on your system. Building the testing for RE2 requires GoogleTest (https://github.com/
重箱の隅で恐縮ですが。弾さんは (function(e){ e.innerHTML = e.innerHTML.replace( /東京都?([\u3200-\u4DBF\u4E00-\u9FFF\uF900-\uFAFF]+)/g, '首都$1東京' ) })(document.body)漢字を判定する正規表現が工夫のしどころでしょうか。[一-龠]はUnicode時代にはちょっと古い。grep CJK /usr/local/lib/perl5/5.10.0/unicore/Blocks.txtが参考資料代わりです。CJK Unified Ideographだけ欲しければ[\u4E00-\u9FFF]でも行けます。 404 Blog Not Found:javascript+regexp - ていうか首都最強東京bookmarklet とおっしゃってるけど、[\u4E00-\u9FFF]
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く