From 0e53bf5a114671a27fb78d995ddc15b374b8fa1b Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Wed, 25 Jul 2012 11:20:28 -0400 Subject: [PATCH] Hmm, I guess we have to preserve the regexp object between execs. --- static/js/potd.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/static/js/potd.js b/static/js/potd.js index 8bc2530..67286db 100644 --- a/static/js/potd.js +++ b/static/js/potd.js @@ -88,7 +88,8 @@ function parse_list_file_name(data) { } var filenames = []; - while ((match = /\*\s*\[\[:File:(.*?)\]\]/g.exec(content)) !== null) { + var regexp = /\*\s*\[\[:File:(.*?)\]\]/g; + while ((match = regexp.exec(content)) !== null) { filenames.push(match[1]); } var filename = filenames[Math.floor(Math.random() * filenames.length)];