Socket
Socket
Sign inDemoInstall

github.com/gijsbers/go-pcre

Package Overview
Dependencies
0
Alerts
File Explorer

Install Socket

Detect and block malicious and high-risk dependencies

Install

    github.com/gijsbers/go-pcre

Package pcre provides access to the Perl Compatible Regular Expresion library, PCRE. It implements two main types, Regexp and Matcher. Regexp objects store a compiled regular expression. They consist of two immutable parts: pcre and pcre_extra. Compile()/MustCompile() initialize pcre. Calling Study() on a compiled Regexp initializes pcre_extra. Compilation of regular expressions using Compile or MustCompile is slightly expensive, so these objects should be kept and reused, instead of compiling them from scratch for each matching attempt. CompileJIT and MustCompileJIT are way more expensive, because they run Study() after compiling a Regexp, but they tend to give much better perfomance: http://sljit.sourceforge.net/regex_perf.html Matcher objects keeps the results of a match against a []byte or string subject. The Group and GroupString functions provide access to capture groups; both versions work no matter if the subject was a []byte or string, but the version with the matching type is slightly more efficient. Matcher objects contain some temporary space and refer the original subject. They are mutable and can be reused (using Match, MatchString, Reset or ResetString). For details on the regular expression language implemented by this package and the flags defined below, see the PCRE documentation. http://www.pcre.org/pcre.txt


Version published

Readme

Source

go-pcre

GoDoc

This is a Go language package providing support for Perl Compatible Regular Expressions (PCRE).

Installation

Install the package for Debian as follows:

sudo apt-get install libpcre++-dev
go get github.com/gijsbers/go-pcre

Usage

Go programs that depend on this package should import this package as follows to allow automatic downloading:

import "github.com/gijsbers/go-pcre"

History

This is a clone of golang-pkg-pcre by Florian Weimer, which has been placed on Github by Glenn Brown, so it can be fetched automatically by Go's package installer.

Glenn Brown added FindIndex() and ReplaceAll() to mimic functions in Go's default regexp package.

Mathieu Payeur Levallois added Matcher.ExtractString().

Malte Nuhn added GroupIndices() to retrieve positions of a matching group.

Chandra Sekar S added Index() and stopped invoking Match() twice in FindIndex().

Misakwa added support for pkg-config to locate libpcre.

Yann Ramin added ReplaceAllString() and changed Compile() return type to error.

Nikolay Sivko modified name2index() to return error instead of panic.

Harry Waye exposed raw pcre_exec.

Hazzadous added partial match support.

Pavel Gryaznov added support for JIT compilation.

FAQs

Last updated on 14 Dec 2016

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc