Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1264,7 +1264,7 @@ const CONST = {
CARD_NUMBER: /^[0-9]{15,16}$/,
CARD_SECURITY_CODE: /^[0-9]{3,4}$/,
CARD_EXPIRATION_DATE: /^(0[1-9]|1[0-2])([^0-9])?([0-9]{4}|([0-9]{2}))$/,
ROOM_NAME: /^#[a-z0-9à-ÿ-]{1,80}$/,
ROOM_NAME: /^#[\p{Ll}0-9-]{1,80}$/u,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@0xmiroslav \p{Ll} will include the lowercase letters from any language, e.g., Greek and Cyrillic alphabets will also be valid.

And if we want to accept only Latin lowercase characters explicitly, we must adjust the regex accordingly.
Then We have to use this regex /^#(?:((?=\p{Script=Latin})\p{Ll})|[0-9-]){1,80}$/u that will check the Latin script lowercase alphabets only, above regex will create positive lookahead, which asserts that the following character(s) are Latin script characters which following by lowercase letter.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't support other languages yet than Spanish, but I think it's fine to accept alphabets from other languages.
@thienlnam what do you think?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I think that's fine to accept other language alphabets


// eslint-disable-next-line max-len, no-misleading-character-class
EMOJIS: /[\p{Extended_Pictographic}](\u200D[\p{Extended_Pictographic}]|[\u{1F3FB}-\u{1F3FF}]|[\u{E0020}-\u{E007F}]|\uFE0F|\u20E3)*|[\u{1F1E6}-\u{1F1FF}]{2}|[#*0-9]\uFE0F?\u20E3/gu,
Expand Down
8 changes: 8 additions & 0 deletions tests/unit/ValidationUtilsTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,14 @@ describe('ValidationUtils', () => {
test('room name with spanish Accented letters and dashes', () => {
expect(ValidationUtils.isValidRoomName('#sala-de-opinión')).toBe(true);
});

test('room name with division sign (÷)', () => {
expect(ValidationUtils.isValidRoomName('#room-name-with-÷-sign')).toBe(false);
});

test('room name with Greek alphabets and Cyrillic alphabets', () => {
expect(ValidationUtils.isValidRoomName('#σοβαρός-серьезный')).toBe(true);
});
});

describe('isValidWebsite', () => {
Expand Down