fix(striker-ui): export regexp string patterns

main
Tsu-ba-me 11 months ago
parent 198dd08c18
commit d6ebd523c8
  1. 22
      striker-ui/lib/consts/REG_EXP_PATTERNS.ts

@ -1,22 +1,20 @@
const alphanumeric = '[a-z0-9]';
const alphanumericDash = '[a-z0-9-]';
const hex = '[0-9a-f]';
const octet = '(?:25[0-5]|(?:2[0-4]|1[0-9]|[1-9]|)[0-9])';
export const P_ALPHANUM = '[a-z0-9]';
export const P_ALPHANUM_DASH = '[a-z0-9-]';
export const P_HEX = '[0-9a-f]';
export const P_OCTET = '(?:25[0-5]|(?:2[0-4]|1[0-9]|[1-9]|)[0-9])';
const ipv4 = `(?:${octet}[.]){3}${octet}`;
export const P_IPV4 = `(?:${P_OCTET}[.]){3}${P_OCTET}`;
export const P_UUID = `${P_HEX}{8}-(?:${P_HEX}{4}-){3}${P_HEX}{12}`;
export const REP_DOMAIN = new RegExp(
`^(?:${alphanumeric}(?:${alphanumericDash}{0,61}${alphanumeric})?[.])+${alphanumeric}${alphanumericDash}{0,61}${alphanumeric}$`,
`^(?:${P_ALPHANUM}(?:${P_ALPHANUM_DASH}{0,61}${P_ALPHANUM})?[.])+${P_ALPHANUM}${P_ALPHANUM_DASH}{0,61}${P_ALPHANUM}$`,
);
export const REP_IPV4 = new RegExp(`^${ipv4}$`);
export const REP_IPV4 = new RegExp(`^${P_IPV4}$`);
export const REP_IPV4_CSV = new RegExp(`^(?:${ipv4}\\s*,\\s*)*${ipv4}$`);
export const REP_IPV4_CSV = new RegExp(`^(?:${P_IPV4}\\s*,\\s*)*${P_IPV4}$`);
// Peaceful string is temporarily defined as a string without single-quote, double-quote, slash (/), backslash (\\), angle brackets (< >), and curly brackets ({ }).
export const REP_PEACEFUL_STRING = /^[^'"/\\><}{]*$/;
export const REP_UUID = new RegExp(
`^${hex}{8}-(?:${hex}{4}-){3}${hex}{12}$`,
'i',
);
export const REP_UUID = new RegExp(`^${P_UUID}$`, 'i');

Loading…
Cancel
Save