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

feature: regexp: support pattern '\1' #42549

Closed
eraac opened this issue Nov 12, 2020 · 2 comments
Closed

feature: regexp: support pattern '\1' #42549

eraac opened this issue Nov 12, 2020 · 2 comments

Comments

@eraac
Copy link

eraac commented Nov 12, 2020

Add the possibility to use the contents in capture in a regex with the pattern \1

These kinds of regex doesn't work (\d+):\1; \1 should be equal to the content of the first capture \d+

# https://play.golang.org/p/6jLRaiw2-BC
panic: regexp: Compile(`(\d+):\1`): error parsing regexp: invalid escape sequence: `\1`

This will be useful for some app who use the package regexp (ex. prometheus)

@mvdan
Copy link
Member

mvdan commented Nov 12, 2020

@ianlancetaylor
Copy link
Contributor

This is working as designed, sorry. See the discussion at https://swtch.com/~rsc/regexp/.

@golang golang locked and limited conversation to collaborators Nov 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants