// Exported array of common regex snippets
export const commonRegExp = [
id: 'exact-string-match',
title: 'Exact string match',
description: 'Match the exact string using ^ and $ anchors.',
example: 'const regexp = /^abc$/',
title: 'Match empty string',
description: 'Match an empty string with start and end anchors.',
example: 'const regexp = /^$/',
id: 'whitespace-sequences',
title: 'Match whitespace sequences',
description: 'Match one or more whitespace characters.',
example: 'const regexp = /\\s+/g',
title: 'Match line breaks',
description: 'Match CR, LF, or CRLF across lines.',
pattern: '\\r|\\n|\\r\\n',
example: 'const regexp = /\\r|\\n|\\r\\n/gm',
'A reasonably strict email validation with case-insensitive flag.',
"^(?!\\.)(?!.*\\.\\.)([A-Z0-9_'\\+\\-\\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\\-]*\\.)+[A-Z]{2,}$",
"const regexp = /^(?!\\.)(?!.*\\.\\.)([A-Z0-9_'\\+\\-\\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\\-]*\\.)+[A-Z]{2,}$/i",
id: 'non-word-characters',
title: 'Match non-word characters',
'Match any character that is not a word character or whitespace.',
example: 'const regexp = /[^\\w\\s]/gi',
id: 'alphanumeric-dashes',
title: 'Match alphanumeric, dashes and hyphens',
description: 'Useful for URL slugs.',
pattern: '^[a-zA-Z0-9-_]+$',
example: 'const regexp = /^[a-zA-Z0-9-_]+$/',
id: 'letters-and-whitespace',
title: 'Match letters and whitespaces',
description: 'Allow letters and space characters only.',
pattern: '^[A-Za-z\\s]+$',
example: 'const regexp = /^[A-Za-z\\s]+$/',
id: 'pattern-not-included',
title: 'Pattern not included',
'Negative lookahead to ensure certain sub-patterns are not present.',
pattern: '^((?!(abc|bcd)).)*$',
example: 'const regexp = /^((?!(abc|bcd)).)*$/g',
id: 'text-inside-brackets',
title: 'Text inside parentheses',
'Capture text inside parentheses. Swap delimiters for other bracket types.',
pattern: '\\(([^)]+)\\)',
example: 'const regexp = /\\(([^)]+)\\)/g',
title: 'Validate GUID/UUID (v4)',
description: 'Validate a v4 UUID format.',
'^[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-4[0-9a-fA-F]{3}\\-(8|9|a|b)[0-9a-fA-F]{3}\\-[0-9a-fA-F]{12}$',
'const regexp = /^[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-4[0-9a-fA-F]{3}\\-(8|9|a|b)[0-9a-fA-F]{3}\\-[0-9a-fA-F]{12}$/',
id: 'validate-date-ddmmyyyy',
title: 'Validate date format (DD/MM/YYYY)',
description: 'Validate day, month and year with / or - separators.',
'^(0?[1-9]|[12][0-9]|3[01])[\\/\\-](0?[1-9]|1[012])[\\/\\-]\\d{4}$',
'const regexp = /^(0?[1-9]|[12][0-9]|3[01])[\\/\\-](0?[1-9]|1[012])[\\/\\-]\\d{4}$/',
title: 'Chunk string into n-size chunks',
'Match between 1 and n characters; replace 2 with desired chunk size.',
example: 'const regexp = /.{1,2}/g // where 2 is the chunk size',