solana-developers / solana-actions

https://solana-developers.github.io/solana-actions/
Apache License 2.0
92 stars 38 forks source link

Regex Pattern Fails to Match Hyphenated Identifiers in Identifier Parsing #24

Closed Jovian-Dsouza closed 3 weeks ago

Jovian-Dsouza commented 1 month ago

Description:

The current regex pattern ^([\w\d]+:){2,} used for identifier parsing does not correctly handle strings that contain hyphens, such as solana-action:. The pattern is limited to word characters and digits, excluding hyphens, resulting in failed matches for identifiers with hyphens.

To resolve this, the regex needs to be updated to ^([\w\d\-]+:){2,}, which will include hyphens in the character class. Updating the regex pattern and corresponding test cases will ensure that all valid identifiers are correctly matched.

Steps to Reproduce:

  1. Use the current regex ^([\w\d]+:){2,} on a string containing a hyphen, like solana-action:.
  2. Observe that the pattern fails to match.

Expected Behavior:

The regex should correctly match strings with hyphens in identifiers.

Proposed Solution:

Update the regex to ^([\w\d\-]+:){2,} and modify test cases accordingly.

Impact:

This affects all functionality relying on correct identifier parsing, potentially causing errors or missed matches in critical components.