Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid regular expression: (?i): Invalid group #817

Open
2 of 5 tasks
cjxe opened this issue Nov 4, 2024 · 4 comments
Open
2 of 5 tasks

Invalid regular expression: (?i): Invalid group #817

cjxe opened this issue Nov 4, 2024 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@cjxe
Copy link

cjxe commented Nov 4, 2024

Description:

When I type (?i) into a regex rule, then the runner throws an error.

Action version:

Latest version.

Platform:

  • Ubuntu
  • macOS
  • Windows

Runner type:

  • Hosted
  • Self-hosted

Repro steps:

Add the following rule to labeler.yml:

SOMELABEL:
  - head-branch: '^(?i)(a).*'

Expected behavior:

The error shouldn't be thrown.

Actual behavior:

GitHub Actions runner on ubuntu-latest throw the following error:

The configuration file (path: .github/labeler.yml) was not found locally, fetching via the api
Error: SyntaxError: Invalid regular expression: /^(?i)(a).*/: Invalid group
Error: Invalid regular expression: /^(?i)(a).*/: Invalid group
@cjxe cjxe added bug Something isn't working needs triage labels Nov 4, 2024
@mahabaleshwars
Copy link

Hello @cjxe,
Thank you for creating this issue. We will investigate it and provide feedback as soon as we have some updates.

@suyashgaonkar suyashgaonkar self-assigned this Dec 20, 2024
@suyashgaonkar
Copy link
Contributor

Hi @cjxe , We did the initial investigation and it looks like the regex mentioned in the issue seems to be syntactically wrong, can you please help us to understand the use case of the regex or what exactly are you looking to achieve so that we could understand it better and come up with a solution.

@cjxe
Copy link
Author

cjxe commented Dec 24, 2024

@suyashgaonkar - in this example, my aim was to match all the following strings:

  • ads-0000
  • Ads-0000
  • aDs-0000
  • ADs-0000
  • adS-0000
  • AdS-0000
  • aDS-0000
  • ADS-0000

So, I created this rule: "match the string that starts with a or A". See screenshot below:

image

@suyashgaonkar
Copy link
Contributor

suyashgaonkar commented Dec 27, 2024

Hi @cjxe , Thank you for responding and providing us more details. As you have mentioned in the screenshot you have selected PCRE2 (regex flavour) to compile the mentioned regex code. (?i) modifier is not supported by all the regex flavours, actions/labelers uses javascript behind the scenes hence you would need to modify to something that would work on javascript flavour. We would recommend the following change :- “^(a|A).*” in the regex for the mentioned use case.
Kindly refer to following workflow run and labeler.yml config file for more details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants