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 Request: Allow regexes inside of slices and structs #3

Open
Sculas opened this issue Jan 12, 2025 · 0 comments
Open

Feature Request: Allow regexes inside of slices and structs #3

Sculas opened this issue Jan 12, 2025 · 0 comments

Comments

@Sculas
Copy link

Sculas commented Jan 12, 2025

Hi. thank you so much for this project! It's such an immense help in porting hundreds of regexes from .NET to Go.

I wanted to use the code generator but noticed that it doesn't seem to recognize regexes inside of slices:

var regexInSlice = []*regexp2.Regexp{
	regexp2.MustCompile(`^test1$`, regexp2.Compiled),
	regexp2.MustCompile(`^test2$`, regexp2.Compiled),
}

Same goes for structs:

type regexReplace struct {
	Regex       *regexp2.Regexp
	Replacement string
}

var regexInStruct = &regexReplace{
	Regex:       regexp2.MustCompile(`^foo$`, regexp2.Compiled),
	Replacement: "bar",
}

I was wondering if this could be supported at some point in the future?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant