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

The “unwanted characters regex” matches wanted characters #35

Open
remi opened this issue Nov 13, 2019 · 0 comments
Open

The “unwanted characters regex” matches wanted characters #35

remi opened this issue Nov 13, 2019 · 0 comments

Comments

@remi
Copy link

remi commented Nov 13, 2019

Hi!

I found a potential bug in the following line:

|> remove_unwanted_chars(separator, ~r/([^A-Za-z0-9가-힣])+/)

The line replaces all characters that does not match A-Za-z0-9가-힣 with the separator character.

However, we found an unwanted characters that fall under this expression, namely (U+2009).

source = "foo bar" # This is "foo<U+2009>bar"

String.replace(source, ~r/([^a-z0-9가-힣])+/, "-")
# => "foo bar"

String.replace(source, ~r/([^a-z0-9])+/, "-")
# => "foo-bar"

The behavior is the same for the U+2010, U+2011, U+2012, etc. characters.

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

1 participant