From 67810a8a0b08fc8697ee8fc8843af3757c12a421 Mon Sep 17 00:00:00 2001 From: jmccrohan Date: Wed, 6 Apr 2011 15:29:05 +0100 Subject: Initial Commit --- src/chrome/content/dialogs/editcommon.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/chrome/content/dialogs/editcommon.js (limited to 'src/chrome/content/dialogs/editcommon.js') diff --git a/src/chrome/content/dialogs/editcommon.js b/src/chrome/content/dialogs/editcommon.js new file mode 100644 index 0000000..c24b619 --- /dev/null +++ b/src/chrome/content/dialogs/editcommon.js @@ -0,0 +1,18 @@ +//Has Special Chars +// + returns true if it only +// + contains allowed chars +function mproxy_allowedChars(str){ + //var regex = new RegExp("[\\s\\.a-zA-Z0-9_]", "g"); //This does not allow utf-8 text! + var regex = new RegExp("[(){}\\\[\\\]<>,;:/~`'\"*?^$#&\\t\\n\\r\\\\]", "g"); + return !regex.test(str); +} + +// Used to test strings +// + converts space to underscore +// + and converts to lowercase +function mproxy_simplify(str){ + str = str.replace(new RegExp("\\s{2,}", "g"), " "); + str = str.replace(new RegExp("\\s", "g"), "_"); + str = str.toLowerCase(); + return str; +} \ No newline at end of file -- cgit v1.2.3