We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Consider the following interactions, which I assumed would produce identical output, but which do not:
r1 := regexp.MustCompile("a(sd)f") m1 := r1.ReplaceAll([]byte("asdf"), []byte(" $1 ")) fmt.Printf("[%s]\n", m1) // this produces the correct output: [ sd ] r2 := pcre.MustCompile("a(sd)f", 0) m2 := r2.ReplaceAll([]byte("asdf"), []byte(" $1 "), 0) fmt.Printf("[%s]\n", m2) // this produces incorrect output: [ $1 ]
The first three lines illustrate the behavior of the standard library. The next three illustrate the behavior of this package.
Is there a way to replace on a match group using this library?
The text was updated successfully, but these errors were encountered:
I got the same issue.Was it solved ?
Sorry, something went wrong.
The PCRE syntax for a backreference is supposed to be \1 rather than $1, but that doesn't work either.
package main import ( "fmt" pcre "github.com/glenn-brown/golang-pkg-pcre/src/pkg/pcre" ) func main () { from := []byte("aaabbbcccc") pattern := "b(.)b" re := pcre.MustCompile(pattern, 0) result := re.ReplaceAll(from, []byte("ddd\\1"), 0) fmt.Printf("Result is: %s\n", result) }
No branches or pull requests
Consider the following interactions, which I assumed would produce identical output, but which do not:
The first three lines illustrate the behavior of the standard library. The next three illustrate the behavior of this package.
Is there a way to replace on a match group using this library?
The text was updated successfully, but these errors were encountered: