1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-20 11:18:00 +01:00

Use the RegExp global function rather than calling the constructor.

This commit is contained in:
Doug Kearns
2008-12-21 22:01:13 +11:00
parent 9ac029441f
commit fbb1f33fab
4 changed files with 5 additions and 5 deletions

View File

@@ -176,7 +176,7 @@ Command.prototype = {
let matches = args.match(/(.*)<<\s*(\S+)$/); let matches = args.match(/(.*)<<\s*(\S+)$/);
if (matches && matches[2]) if (matches && matches[2])
{ {
commandline.inputMultiline(new RegExp("^" + matches[2] + "$", "m"), commandline.inputMultiline(RegExp("^" + matches[2] + "$", "m"),
function (args) { exec(matches[1] + "\n" + args); }); function (args) { exec(matches[1] + "\n" + args); });
return; return;
} }

View File

@@ -817,13 +817,13 @@ function Events() //{{{
if (!filter) if (!filter)
return macros; return macros;
let re = new RegExp(filter); let re = RegExp(filter);
return ([macro, keys] for ([macro, keys] in macros) if (re.test(macro))); return ([macro, keys] for ([macro, keys] in macros) if (re.test(macro)));
}, },
deleteMacros: function (filter) deleteMacros: function (filter)
{ {
let re = new RegExp(filter); let re = RegExp(filter);
for (let [item,] in macros) for (let [item,] in macros)
{ {

View File

@@ -475,7 +475,7 @@ const util = { //{{{
// and returns an array ['www.google.com/search?q=bla', 'www.osnews.com'] // and returns an array ['www.google.com/search?q=bla', 'www.osnews.com']
stringToURLArray: function stringToURLArray(str) stringToURLArray: function stringToURLArray(str)
{ {
let urls = str.split(new RegExp("\s*" + options["urlseparator"] + "\s*")); let urls = str.split(RegExp("\s*" + options["urlseparator"] + "\s*"));
return urls.map(function (url) { return urls.map(function (url) {
try try

View File

@@ -1003,7 +1003,7 @@ function QuickMarks() //{{{
remove: function remove(filter) remove: function remove(filter)
{ {
var pattern = new RegExp("[" + filter.replace(/\s+/g, "") + "]"); var pattern = RegExp("[" + filter.replace(/\s+/g, "") + "]");
for (let [qmark,] in qmarks) for (let [qmark,] in qmarks)
{ {