JS: Fix FP from word boundaries

This commit is contained in:
Asger Feldthaus
2020-01-07 10:04:52 +00:00
parent b604be5cfb
commit 9f6e04887b
2 changed files with 18 additions and 2 deletions

View File

@@ -73,3 +73,11 @@ function searchPrefix(x) {
function searchSuffix(x) {
return /foo?$/.search(x); // OK - `foo?` affects the returned index
}
function wordBoundary(x) {
return /\b/.test(x); // OK - some strings don't have word boundaries
}
function nonWordBoundary(x) {
return /\B/.test(x); // OK - some strings don't have non-word boundaries
}