Open johnhenry opened 5 years ago
This looks interesting, but might be difficult to keep up to date (will depend on maintainer), also I see it uses a lot of unsafe.Pointer (I guess because of c2go), and running go test resulted in a crash ("fatal error: sweep increased allocation count" the second time, first time was about cgo and pointers).
I'm guessing this is not exactly production ready yet, but will definitely keep an eye on this.
After a lot of research, it turns out most uses of PHP's preg_* methods are compatible with re2/golang's own regexp engine.
Conclusion: creating a "re2" ext that exposes golang's regexp engine and also weak (ie. overridable) preg_* methods should allow most PHP apps to work, and might even result in a security improvement as re2's linear time execution isn't subject to the class of attacks abusing pcre features.
+1 for avoiding cgo whenever possible. Most apps dont rely heavily on regex so even if the pure go implementation is slower, it shouldnt matter.
I glanced over my old PHP projects and all of them use regex that's either compatible or can easily be translated to go's regex.
I think this is great!
Might this implementation of libpcre be a suitable replacement for the one mentioned in the readme? https://github.com/Jemmic/libpcre