From 0b0e0a1b49592e992eee66d21fa18180882e9bf2 Mon Sep 17 00:00:00 2001 From: LaustAxelsen Date: Tue, 6 Jan 2015 22:24:54 +0100 Subject: [PATCH 1/2] 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; From 4b960bf01788d966310f908eae0376123e376556 Mon Sep 17 00:00:00 2001 From: LaustAxelsen Date: Tue, 6 Jan 2015 22:29:26 +0100 Subject: [PATCH 2/2] Update README.md --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index 87356d3..cdc2f12 100644 --- a/README.md +++ b/README.md @@ -497,6 +497,18 @@ Returns true if string only contains numbers ``` Returns true if string is only letters +**isWords** +```html + +``` +Returns true if string is only letters, including spaces and tabs + +**isWordsSpecial** +```html + +``` +Returns true if string is only letters, including special letters (a-z,ú,ø,æ,å) + **isLength:min**, **isLength:min:max** ```html