Skip to content

Commit

Permalink
fix: username validation no longer removes numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelmaddock committed Mar 7, 2021
1 parent a081d41 commit 9f2354c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/metastream-app/src/utils/string.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ let EMOJI_REGEX: RegExp

try {
// Need to use constructor to avoid syntax parsing error in Firefox
EMOJI_REGEX = new RegExp('\\p{Emoji}', 'gu')
// https://mathiasbynens.be/notes/es-unicode-property-escapes
EMOJI_REGEX = new RegExp(
'\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation}|\\p{Emoji}\\uFE0F',
'gu'
)
} catch {
// Fallback for browsers not supporting Unicode Property Escapes.
EMOJI_REGEX = /([\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2694-\u2697]|\uD83E[\uDD10-\uDD5D])/g
Expand Down

0 comments on commit 9f2354c

Please sign in to comment.