fix hashtags validation

This commit is contained in:
wryk 2020-03-04 02:04:24 +01:00
parent 02166f9b86
commit 4aa79dc376
1 changed files with 1 additions and 1 deletions

View File

@ -94,7 +94,7 @@
const hashtagsValue = writable($hashtags)
const hashtagsState = derived([hashtagsValue], ([$hashtagsValue]) => {
if ($hashtagsValue.some(hashtag => !/[a-z0-9]+/i.test(hashtag))) {
if ($hashtagsValue.some(hashtag => !/^[a-z0-9]+$/i.test(hashtag))) {
return { valid: false, error: 'Hashtags can only contains alphanumeric characters.' }
} else if ($hashtagsValue.length === 0) {
return { valid: false, error: 'At least one hashtag is required.' }