Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

it doesn't work when the word has ? #6

Open
Tomoka64 opened this issue Aug 3, 2021 · 1 comment
Open

it doesn't work when the word has ? #6

Tomoka64 opened this issue Aug 3, 2021 · 1 comment

Comments

@Tomoka64
Copy link

Tomoka64 commented Aug 3, 2021

Hi! I have been using your library. it is very awesome!
one thing i noticed is when trying to filter with question mark, it doesnt work like other words.

iex(4)> c = Expletive.configure(blacklist: ["cc?", "cc?cc", "ó?ó"])
%Expletive.Configuration{
  blacklist: ["cc?", "cc?cc", "ó?ó"],
  regex: ~r/\b(?:cc\?|cc\?cc|ó\?ó)\b/iu,
  replacement: :default,
  whitelist: [] 
}
iex(5)> Expletive.sanitize "cc?", c, {:repeat, "*"}               
"cc?"
iex(6)> Expletive.sanitize "cc?cc", c, {:repeat, "*"}
"***cc"
@xavier
Copy link
Owner

xavier commented Aug 4, 2021

Thanks for your report.

I had a quick look and this might be somewhat tricky to fix as the "?" character trips the word boundary scanning which relies on \b anchors.

I could not get a quick fix to work without any regression in the short amount of time I had to devote to this today, I'll have to come up with an appropriate solution.

Ideas are of course welcome! 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants