Skip to content

Commit

Permalink
Changed name validation pattern #1599
Browse files Browse the repository at this point in the history
  • Loading branch information
bsekachev committed Jun 8, 2020
1 parent 7d1cce0 commit b3e7065
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion cvat-ui/src/utils/validation-patterns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,19 @@ const validationPatterns = {
message: 'Only characters (a-z), (A-Z), (0-9), -, _ are available',
},

/*
\p{Pd} - dash connectors
\p{Pc} - connector punctuations
\p{Cf} - invisible formatting indicator
\p{L} - any alphabetic character
Useful links:
https://stackoverflow.com/questions/4323386/multi-language-input-validation-with-utf-8-encoding
https://stackoverflow.com/questions/280712/javascript-unicode-regexes
https://stackoverflow.com/questions/6377407/how-to-validate-both-chinese-unicode-and-english-name
*/
validateName: {
// eslint-disable-next-line
pattern: /^[a-zA-Z]{2,}(([',. -][a-zA-Z ])?[a-zA-Z]*)*$/,
pattern: /^(\p{L}|\p{Pd}|\p{Cf}|\p{Pc}|['\s]){2,}$/gu,
message: 'Invalid name',
},

Expand Down

0 comments on commit b3e7065

Please sign in to comment.