From 0b0e0a1b49592e992eee66d21fa18180882e9bf2 Mon Sep 17 00:00:00 2001 From: LaustAxelsen Date: Tue, 6 Jan 2015 22:24:54 +0100 Subject: [PATCH] Update main.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Include two new basic rules; - isWords (a-z, not case sensitive and spaces e.g. "this is a pretty cat") - isWordsSpecial (a-z, special european letters, not case sensitive and spaces e.g. "sikke en flot ø" or "touché") --- src/main.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main.js b/src/main.js index e9d2196..8c79b4a 100644 --- a/src/main.js +++ b/src/main.js @@ -16,6 +16,12 @@ var validationRules = { 'isAlpha': function (value) { return value.match(/^[a-zA-Z]+$/); }, + 'isWords': function (value) { + return value.match(/^[a-zA-Z\s]+$/); + }, + 'isWordsSpecial': function (value) { + return value.match(/^[a-zA-Z\s\u00C0-\u017F]+$/); + }, isLength: function (value, min, max) { if (max !== undefined) { return value.length >= min && value.length <= max;