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

First occurence in Regex #2

Open
Sim4n6 opened this issue Jun 7, 2023 · 5 comments
Open

First occurence in Regex #2

Sim4n6 opened this issue Jun 7, 2023 · 5 comments
Labels
enhancement New feature or request

Comments

@Sim4n6
Copy link

Sim4n6 commented Jun 7, 2023

Hi, is there a possibility to use regex_replace() to replace the first occurrence of a single character ?

I mean can we have a count=1 like in python

replaced_string = re.sub(regex, replacement, source, count=1)
@A-J-C
Copy link
Collaborator

A-J-C commented Jun 8, 2023

Nice suggestion! Currently, we are leveraging Java's regex matching under the hood to enable regex matching, but we can definitely look into adding more complex arguments.

Would you please be able to provide examples of what use cases you'd expect to use this functionality in?

@Sim4n6
Copy link
Author

Sim4n6 commented Jun 8, 2023

sure, I would like to replace the first occurrence of the dot for Origin bypass.

https://subdomain.example.com ===> https://subdomainXexample.com 

@Sim4n6
Copy link
Author

Sim4n6 commented Jun 8, 2023

Any workaround that comes to your mind, please?

@A-J-C
Copy link
Collaborator

A-J-C commented Jun 8, 2023 via email

@Sim4n6
Copy link
Author

Sim4n6 commented Jun 12, 2023

It took me a while to figure out how. Very hacky way indeed.

I believe this is an interesting feature request for BChecks.

Thank you @A-J-C

@Sim4n6 Sim4n6 closed this as completed Jun 12, 2023
@A-J-C A-J-C added the enhancement New feature or request label Jun 12, 2023
@A-J-C A-J-C reopened this Jun 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

No branches or pull requests

2 participants