Created
December 5, 2012 00:54
-
-
Save shoyan/4210849 to your computer and use it in GitHub Desktop.
jsの日本語バリデーションサンプル
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var wPat = "[a-zA-Z0-9-]"; // 英数字・ハイフン | |
wPat += "|[\u3041-\u3093]"; // ひらがな | |
wPat += "|[\u30A1-\u30F6]"; // カタカナ | |
wPat += "|[・ヽヾゝゞ々ー]"; // 記号 | |
wPat += "|[\u4E00-\u9FFF]"; //漢字 | |
wPat = "^(" + wPat +")+$"; | |
if (!str.match(wPat)) { | |
return false; | |
} | |
return true; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
マジ助かりました、ありがとナス!