diff options
author | drry | 2008-12-15 15:39:03 +0000 |
---|---|---|
committer | drry | 2008-12-15 15:39:03 +0000 |
commit | 28f7f11fdca052b4cfd8fb3d6628dd9b5e95b201 (patch) | |
tree | 2f87bf5a4491bed028ce0d49715ad6ba950d2deb /auto_detect_link.js | |
parent | 2b82d32dbc7924ab4cb50e90da179484e1bf7ff6 (diff) | |
download | vimperator-plugins-28f7f11fdca052b4cfd8fb3d6628dd9b5e95b201.tar.bz2 |
* 西暦4桁で始まる6桁以上なので、続くのは月2桁と思ったんですが、あんま自信ない。
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@26820 d0d07461-0603-4401-acd4-de1884942a52
Diffstat (limited to 'auto_detect_link.js')
-rw-r--r-- | auto_detect_link.js | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/auto_detect_link.js b/auto_detect_link.js index a77df53..87dcd54 100644 --- a/auto_detect_link.js +++ b/auto_detect_link.js @@ -194,15 +194,13 @@ s.replace(new RegExp('^(.{0,'+(n-1)+'})$'), function (s) padChar(c+s, c, n)); - // id っぽい文字か考えてみる! + // ID っぽい文字か考えてみる! // 数字だけで長いのは ID っぽい! - // 年号っぽいのは無視しない方が良いかも。 + // 西暦っぽいのは無視しない方が良いかも。 // 後方00 が含まれているパターンは、インクリメントしてもいい気がする // 830000 => 830001 - function likeID (s) { - s = s.toString(); - return s.match(/^\d{6,}$/) && !s.match(/^(19[8-9]\d|20[0-2]\d)/) && !s.match(/00\d{2}$/); - } + function likeID (s) + /^\d{6,}$/.test(s) && !/^(19[89]|20[012])\d(0[1-9]|1[012])/.test(s) && !/00\d\d$/.test(s); // (次|前)の数字文字列リストを取得 |