golang-pkg-pcre | Perl Compatible Regular Expression shim for Go | Regex library
kandi X-RAY | golang-pkg-pcre Summary
kandi X-RAY | golang-pkg-pcre Summary
This is a Go language package providing Perl-Compatible RegularExpression support using libpcre++. Install the package with the current Debian distribution as follows:.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of golang-pkg-pcre
golang-pkg-pcre Key Features
golang-pkg-pcre Examples and Code Snippets
Community Discussions
Trending Discussions on golang-pkg-pcre
QUESTION
The regexp
in the Go's standard library is quite poor, so I need a more powerful engine, like regex in Python (pip install regex), supporting recursion, backref, look-ahead/behind, etc... .
I found: https://godoc.org/github.com/dlclark/regexp2 .NET compatible, which was quite fine; however, recursion is not working properly.
and several bindings to PCRE, for example: https://godoc.org/github.com/glenn-brown/golang-pkg-pcre/src/pkg/pcre
so, how can I use this binding on Win64?
...ANSWER
Answered 2017-Feb-25 at 14:30You may consider using C++ standard library std::regex
(no third-party library). Wrap the logic in try
block, use catch(...){return ERROR;}
to catch any error, and declare the C function extern "C"
so you can call with cgo.
From https://github.com/golang/go/wiki/cgo (there is a part about Windows):
In order to use cgo on Windows, you'll also need to first install a gcc compiler (for instance, mingw-w64) and have gcc.exe (etc.) in your PATH environment variable before compiling with cgo will work.
That being said, I still think you should consider sticking with the regexp
package and try to make regular expressions as simple as possible. Because complicated regular expressions are likely to hurt readability of code. Another problem is sometimes they introduce subtle bugs which are difficult to spot and fix. So writing more code in Go instead of regex may actually make the life easier.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install golang-pkg-pcre
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page