Browse Source

test: some more examples for REGEXP

pull/7268/head
Raju Udava 1 year ago
parent
commit
23db8cb98b
  1. 22
      packages/nocodb/tests/unit/rest/tests/formula.test.ts

22
packages/nocodb/tests/unit/rest/tests/formula.test.ts

@ -70,11 +70,31 @@ function formulaRegExpBased() {
'REGEX_MATCH("123-45-6789", "\\d{3}-\\d{2}-\\d{4}")',
'REGEX_MATCH("123-45-6789", "\\d{3}-\\d{2}-\\d{4}")',
'REGEX_MATCH("ABC-45-6789", "\\w{3}-\\d{2}-\\d{4}")',
'REGEX_MATCH("123-XY-6789", "\\d{3}-\\w{2}-\\d{4}")',
'REGEX_MATCH("123-XY-6789", "\\d{3}-\\D{2}-\\d{4}")',
'REGEX_MATCH("123-45-$#@!", "123-45-[\\s\\S]{4}")',
'REGEX_MATCH("123456789", "1?2?3?-?4?5-?6?7?8?9?")',
'REGEX_MATCH("123-456789", "\\d{3}-?\\d{2}-?\\d{4}")',
'REGEX_MATCH("123-45-6789", "123-\\d{2}-6789")',
'REGEX_MATCH("abc123", "[a-z]{3}\\d{3}")',
'REGEX_MATCH("A1B2C3", "[A-Z]\\d[A-Z]\\d[A-Z]\\d")',
'REGEX_MATCH("hello123world", "\\w{5}\\d{3}\\w{5}")',
'REGEX_MATCH("email@example.com", "[a-zA-Z]+@[a-zA-Z]+\\.[a-zA-Z]+")',
'REGEX_MATCH("2023-12-14", "\\d{4}-\\d{2}-\\d{2}")',
'REGEX_MATCH("USD 100.50", "USD \\d+\\.\\d{2}")',
'REGEX_MATCH("http://www.example.com", "https?://[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}")',
'REGEX_MATCH("555-1234", "\\d{3}-\\d{4}")',
'REGEX_MATCH("username123", "[a-zA-Z]+\\d{3}")',
'REGEX_MATCH("apple, orange, banana", "\\w+, \\w+, \\w+")',
'REGEX_MATCH("aabbcc", "(\\w{2})\\1")',
'REGEX_MATCH("1234567890", "\\d{10}")',
'REGEX_MATCH("12.34", "\\d+\\.\\d{2}")',
'REGEX_MATCH("123 Main St, City", "\\d+ [a-zA-Z]+ St, [a-zA-Z]+")',
'REGEX_MATCH("X1Y2Z3", "[A-Z]\\d[A-Z]\\d[A-Z]\\d")',
'REGEX_MATCH("555-555-5555", "\\d{3}-\\d{3}-\\d{4}")',
'REGEX_MATCH("password123", "^(?=.*\\d)(?=.*[a-zA-Z]).{8,}$")',
'REGEX_MATCH("12345", "^[0-9]{5}$")',
'REGEX_MATCH("abc123!@#", "[a-zA-Z0-9!@#]+")',
'REGEX_MATCH("12-December-2023", "\\d{2}-[a-zA-Z]+-\\d{4}")',
];
for (let i = 0; i < formulaList.length; i++) {

Loading…
Cancel
Save