-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
FIX: emoji regex and tests #2090
Conversation
✅ Deploy Preview for guileless-rolypoly-866f8a ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
try { | ||
url.parse("http://google.com"); | ||
url.parse("https://google.com/asdf?asdf=ljk3lk4&asdf=234#asdf"); | ||
expect(() => url.parse("asdf")).toThrow(); | ||
expect(() => url.parse("https:/")).toThrow(); | ||
expect(() => url.parse("[email protected]")).toThrow(); | ||
} catch (err) {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My original PR #2045 copied from this test, which had this empty catch
, so I though it would also fix this in the follow up.
I'd fixed this with the somewhat hacky per-character validation, but this is definitely better. I was briefly worried that unicode property escapes might not be supported across all engines/runtimes (we've had issues with lookbehind assertions) but it seems to be. 👍 Thanks! |
so it was really late when Theo put the bounty up on the stupid emoji validation. It had some errors but got merged in while I was sleeping. This fixes some of the issues that were still on the PR. See #2045
It also turns out the regex can be made much nicer using unicode codepoints in the Regex, see: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Unicode_Property_Escapes and https://unicode.org/reports/tr51/#Emoji_Properties