-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Improve regex replacement. #34146
Comments
Pinging code owners:
See Adding Labels via Comments if you do not have permissions to add labels yourself. |
I think it would likely make sense to offer a more powerful alternative regex engine for cases like this where the built-in Go engine isn't sufficient. We could probably add an |
Related to #32167 |
This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping Pinging code owners:
See Adding Labels via Comments if you do not have permissions to add labels yourself. |
This issue has been closed as inactive because it has been stale for 120 days with no activity. |
Component(s)
pkg/ottl
Is your feature request related to a problem? Please describe.
The standard
regexp
in Go is sometimes powerless, which make us hard to do some replacement.For example, I want to replaces pure number path segment in a http url. I tried to use some expression:
/\d+(/|$)
to/?$1
.However, if there are continuous segments, they won't be replaced at once:
/12/34/56/78
->/?/34/?/78
. As positive lookahead is not supported, the only workaround I find this to replace by this expression again, but it will cause 2x cpu usage.(/\d+){1,}(/$)
can match perfectly, but I can't find a way to replace each match of(/\d+)
to/?
.Describe the solution you'd like
{x,}
Describe alternatives you've considered
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: