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

💡 Support named capture groups in RegEx #423

Open
MarcusOtter opened this issue Apr 26, 2023 · 0 comments
Open

💡 Support named capture groups in RegEx #423

MarcusOtter opened this issue Apr 26, 2023 · 0 comments
Labels
improvement 💡 Improvement suggestion

Comments

@MarcusOtter
Copy link
Owner

Describe the improvement

We should support named capture groups in RegEx, and then let the user tell us which groups they want to include in the title and where, with custom variables. If these are used, they should ignore the RegEx matches completely in the title output.

Problems this improvement solves

Right now, with the text:

Never Alone (Kisima Ingitchuna) ~~R$14.99~~ **Grátis** até 27/04/2023 • Epic Games Abra no navegador https://store.epicgames.com/p/never-alone-kisima-ingitchuna Abra no Launcher da Epic Games com.epicgames.launcher://store/p/never-alone-kisima-ingitchuna

It would be hard to make the title

Free on Epic Games: Never Alone (Kisima Ingitchuna)

Because it includes two parts of the input that are in reverse order. If we could use named RegEx groups it would be an easy query, something like this:

/(?<title>.*?) ~~.*(?<platform>steam|epic games)/i

Which could make the title something like this... (not sure about how we design the API yet)

Free on $platform: $title /(?<title>.*?)~~.*(?<platform>steam|epic games)/i

Alternative solutions

The alternative is writing really complex RegExes that makes sure to not match any text and only save in capture groups. Even then, this is super hard because it's in reverse order.

@MarcusOtter MarcusOtter added the improvement 💡 Improvement suggestion label Apr 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement 💡 Improvement suggestion
Projects
None yet
Development

No branches or pull requests

1 participant