Skip to content

Conversation

pawan1210
Copy link
Contributor

How the regex works ?

  1. [a-fh-zA-Z][a-zA-Z0-9\-._~%+]{0,254}: Matches if the string starts with any letter except g, followed by 0 to 254 allowed characters (a-zA-Z0-9\-._~%+).
  2. g(...): Matches if the string starts with g, and the rest of the string matches one of the nested alternatives:
    • $: The string is exactly "g".
    • [^o][a-zA-Z0-9\-._~%+]{0,253}: The second character is not o, followed by 0 to 253 allowed characters.
    • o(...): The second character is o (starts "go"), and the rest matches:
      • $: The string is exactly "go".
      • [^o][a-zA-Z0-9\-._~%+]{0,252}: The third character is not 'o', followed by 0 to 252 allowed characters.
      • o(...): The third character is 'o' (starts "goo"), and the rest matches:
        • $: The string is exactly "goo".
        • [^g][a-zA-Z0-9\-._~%+]{0,251}: The fourth character is not 'g', followed by 0 to 251 allowed characters.

@pawan1210 pawan1210 requested review from a team, ayushmjain, imrannayer and q2w as code owners April 9, 2025 09:13
@pawan1210 pawan1210 force-pushed the fix/topic-regex branch 2 times, most recently from 6617a38 to 734735a Compare April 14, 2025 06:05
name: topic
title: Topic
regexValidation: ^(?!goog)[a-zA-Z][a-zA-Z0-9\-._~%+]{0,254}$
regexValidation: `^([a-fh-zA-FH-Z][a-zA-Z0-9\-._~%+]{0,254}|[gG]($|[^oO][a-zA-Z0-9\-._~%+]{0,253}|[oO]($|[^oO][a-zA-Z0-9\-._~%+]{0,252}|[oO]($|[^gG][a-zA-Z0-9\-._~%+]{0,251}))))$`
Copy link
Collaborator

Choose a reason for hiding this comment

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

The lint validation is failing with this regex. You can escape special characters to make is valid string in yaml

@q2w q2w force-pushed the fix/topic-regex branch from 45459ce to 612a4e8 Compare April 21, 2025 09:12
@q2w q2w enabled auto-merge (squash) April 21, 2025 09:13
@q2w q2w merged commit 4e92a87 into terraform-google-modules:main Apr 21, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants