Fixed RegEx to be super accurate again

This commit is contained in:
benmcmahon100
2015-08-25 21:03:50 +01:00
parent 16cd733dd3
commit 8509197b6d

View File

@ -243,7 +243,7 @@ if(typeof prodOrDev !== 'undefined') {
editor.setValue(editor.getValue() + "-->"); editor.setValue(editor.getValue() + "-->");
editorValueForIFrame = editorValueForIFrame + "-->"; editorValueForIFrame = editorValueForIFrame + "-->";
} }
if(!editor.getValue().match(/\$\s*?\(\s*?\$\s*?\)/gi) ) { if(!editor.getValue().match(/\$\s*?\(\s*?\$\s*?\)/gi)){
safeHTMLRun(false); safeHTMLRun(false);
} }
} }
@ -476,7 +476,7 @@ function bonfireExecute() {
ga('send', 'event', 'Challenge', 'ran-code', challenge_Name); ga('send', 'event', 'Challenge', 'ran-code', challenge_Name);
userTests = null; userTests = null;
$('#testSuite').empty(); $('#testSuite').empty();
if(challengeType !== "0"){ if(challengeType !== "0" && !editor.getValue().match(/\$\s*?\(\s*?\$\s*?\)/gi)){
var userJavaScript = myCodeMirror.getValue(); var userJavaScript = myCodeMirror.getValue();
var failedCommentTest = false; var failedCommentTest = false;
if (userJavaScript.match(/\/\*/gi) && userJavaScript.match(/\*\//gi) == null) { if (userJavaScript.match(/\/\*/gi) && userJavaScript.match(/\*\//gi) == null) {
@ -520,7 +520,7 @@ function bonfireExecute() {
editor.setValue(editor.getValue() + "-->"); editor.setValue(editor.getValue() + "-->");
editorValueForIFrame = editorValueForIFrame + "-->"; editorValueForIFrame = editorValueForIFrame + "-->";
} }
if(!editor.getValue().match(/\$\(\$\)/gi) && challengeType === "0") { if(!editor.getValue().match(/\$\s*?\(\s*?\$\s*?\)/gi) && challengeType === "0") {
safeHTMLRun(true); safeHTMLRun(true);
} }
} }