Skip to content

Commit c32b9ad

Browse files
authored
Merge pull request #1156 from zhx828/hotfix
Allow new line in text validation
2 parents 7b15ec3 + cc3fd60 commit c32b9ad

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/main/webapp/app/config/constants/regex.spec.ts

+3
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ describe('Regex constants test', () => {
6060
'Test ÿ',
6161
"Test !@#$%^&*()_+[]{}|;:',.<>?",
6262
'1234567890',
63+
'test\ntest',
64+
'test\rtest',
65+
'test\r\ntest',
6366
])('Truthy text: %s', text => {
6467
expect(VALID_LATIN_TEXT.test(text)).toBeTruthy();
6568
});

src/main/webapp/app/config/constants/regex.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
// (PMID: 11753428, 16007150, 21467160)
44
// (NCT1234567)
55
export const REF_CAPTURE = /(\(\s*(?:PMID|NCT|Abstract):?.*?(?:\([^()]*\).*?)*\))/i;
6-
export const VALID_LATIN_TEXT = /^[\p{Script=Latin}\p{M}\p{N}\p{Z}\p{P}\p{Sm}\p{Sc}\p{Sk}]+$/u;
6+
export const VALID_LATIN_TEXT = /^[\p{Script=Latin}\p{M}\p{N}\p{Z}\p{P}\p{Sm}\p{Sc}\p{Sk}\r\n]+$/u;
77

88
export const ALTERNATIVE_ALLELES_REGEX = /([A-Z]+[0-9]+)([A-Z]+(\/[A-Z]+)*)/i;

0 commit comments

Comments
 (0)