Skip to content

Instantly share code, notes, and snippets.

@gtzilla
Created October 26, 2011 05:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gtzilla/1315520 to your computer and use it in GitHub Desktop.
Save gtzilla/1315520 to your computer and use it in GitHub Desktop.
var raw_str_regex = "(?:\\s|^)((?:\!|\-)\\w+)";
var regex = new RegExp(raw_str_regex, "gm");
var lst = [
"this is !not",
"this is !not",
"this is !not",
"this is !not",
"this is !not",
"this is !not"
];
var check_okay = [];
for(var i=0; i<lst.length; i++) {
var test_value = regex.test( lst[i] );
console.log(test_value, lst[i]);
if(test_value === true) {
check_okay.push(test_value);
}
}
if(check_okay.length === lst.length) {
console.log("okay");
} else {
console.log("FAILED!!!!!!");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment