<commit_before>package utils

import (
	"errors"

	pcre "github.com/glenn-brown/golang-pkg-pcre/src/pkg/pcre"
)

type Regexp struct {
	exp pcre.Regexp
}

func (r *Regexp) Match(suspected string) bool {
	return r.exp.MatcherString(suspected, 0).Matches()
}

func (r *Regexp) Groups(suspected string) ([]string, error) {
	matcher := r.exp.MatcherString(suspected, 0)
	if !matcher.Matches() {
		return nil, errors.New("Cannot match")
	}

	groups := make([]string, matcher.Groups())
	for idx := 0; idx < len(groups); idx++ {
		groups[idx] = matcher.GroupString(idx+1)
	}

	return groups, nil
}

func CreateRegexp(expression string) *Regexp {
	return &Regexp{exp: pcre.MustCompile(expression, 0)}
}<commit_msg>go fmt<commit_after>package utils

import (
	"errors"

	pcre "github.com/glenn-brown/golang-pkg-pcre/src/pkg/pcre"
)

type Regexp struct {
	exp pcre.Regexp
}

func (r *Regexp) Match(suspected string) bool {
	return r.exp.MatcherString(suspected, 0).Matches()
}

func (r *Regexp) Groups(suspected string) ([]string, error) {
	matcher := r.exp.MatcherString(suspected, 0)
	if !matcher.Matches() {
		return nil, errors.New("Cannot match")
	}

	groups := make([]string, matcher.Groups())
	for idx := 0; idx < len(groups); idx++ {
		groups[idx] = matcher.GroupString(idx + 1)
	}

	return groups, nil
}

func CreateRegexp(expression string) *Regexp {
	return &Regexp{exp: pcre.MustCompile(expression, 0)}
}
{'fraction_non_alphanumeric': 0.15516014234875444, 'fraction_numerical': 0.0071174377224199285, 'mean_word_length': 4.762295081967213, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2305153', 'n_tokens_mistral': 561, 'n_tokens_neox': 524, 'n_words': 118}