From e8c8de7cb998cd98da1e40f347e58cacb7c4fd5d Mon Sep 17 00:00:00 2001 From: John Foerch Date: Fri, 27 Jan 2012 22:14:25 -0500 Subject: [PATCH] choice_regex renamed to choice_regexp --- modules/string.js | 7 +++---- modules/utils.js | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/modules/string.js b/modules/string.js index 116ebfd..a8c1a0f 100644 --- a/modules/string.js +++ b/modules/string.js @@ -29,11 +29,10 @@ function quotemeta (str) { return str.replace(/([^a-zA-Z0-9])/g, "\\$1"); } -/* Given a list of choices (strings), return a regex which matches any +/* Given a list of choices (strings), return a regexp which matches any of them*/ -function choice_regex (choices) { - var regex = "(?:" + choices.map(quotemeta).join("|") + ")"; - return regex; +function choice_regexp (choices) { + return ("(?:" + choices.map(quotemeta).join("|") + ")"); } diff --git a/modules/utils.js b/modules/utils.js index 177fbdd..0fee580 100644 --- a/modules/utils.js +++ b/modules/utils.js @@ -650,7 +650,7 @@ function scroll_selection_into_view (field) { * build_url_regexp builds a regular expression to match URLs for a given * web site. * - * Both the $domain and $path arguments can be either regexes, in + * Both the $domain and $path arguments can be either regexps, in * which case they will be matched as is, or strings, in which case * they will be matched literally. * @@ -675,7 +675,7 @@ function build_url_regexp () { } var path = regexp_to_string(arguments.$path); var tlds = arguments.$tlds; - var regexp = "^https?://" + domain + "\\." + choice_regex(tlds) + "/" + path; + var regexp = "^https?://" + domain + "\\." + choice_regexp(tlds) + "/" + path; return new RegExp(regexp); } -- 2.11.4.GIT