Skip to content

Commit

Permalink
fix: filter should split by brackets or symbols (#120)
Browse files Browse the repository at this point in the history
Co-authored-by: Shigma <[email protected]>
  • Loading branch information
MaikoTan and shigma authored Nov 19, 2022
1 parent 1bdfbc9 commit 8eb89dc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ export function parseInput(input: string, config: Config, forbidden: Forbidden[]

// remove forbidden words
const positive = input.split(/,\s*/g).filter((word) => {
word = word.replace(/[^a-z0-9]+/g, ' ').trim()
word = word.replace(/[\x00-\x7f]/g, s => s.replace(/[^0-9a-zA-Z]/, ' ')).replace(/\s+/, ' ').trim()
if (!word) return false
for (const { pattern, strict } of forbidden) {
if (strict && word.split(/\W+/g).includes(pattern)) {
Expand Down

0 comments on commit 8eb89dc

Please sign in to comment.