Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.