Skip to content

Commit

Permalink
fix answer regex even more
Browse files Browse the repository at this point in the history
  • Loading branch information
sauerbraten committed Oct 20, 2021
1 parent 91ea39a commit 19ed702
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions novibot.js
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,7 @@ function quiz(msg) {
const correctAnswer = new RegExp(
answer
.replace(/\s/, "\\s?") // whitespace is optional
.replace(/^\W/, "").replace(/\W$/, "") // trim non-word characters at beginning and end
.replace(/(\D)\W(\D)/, "$1\\W?$2"), // non-word characters (punctuation etc.) are optional (except '.' in numerals)
"ig" // ignore case & match globally
);
Expand Down

0 comments on commit 19ed702

Please sign in to comment.