<commit_before>package router

import (
	"regexp"
)

type path interface {
	uri() string
	match(path string) (bool, error)
}

type namedPath struct {
	uriPath string
}

func newNamedPath(uriPath string) path {
	return &namedPath{uriPath: uriPath}
}

func (p *namedPath) match(path string) (bool, error) {
	namedParamRegEx, err := regexp.Compile(`/(\(\?)?:\w+/g`)
	if err != nil {
		return false, err
	}
	regExURI := namedParamRegEx.ReplaceAllString(p.uriPath, `[a-zA-Z0-9]+`)
	return regexp.MatchString(regExURI, path)
}

func (p *namedPath) uri() string {
	return p.uriPath
}<commit_msg>bug fix for the proper regex matches on urls<commit_after>package router

import "regexp"

type path interface {
	uri() string
	match(path string) (bool, error)
}

type namedPath struct {
	uriPath string
}

func newNamedPath(uriPath string) path {
	return &namedPath{uriPath: uriPath}
}

func (p *namedPath) match(path string) (bool, error) {
	namedParamRegEx, err := regexp.Compile(`(\(\?)?:\w+`)
	if err != nil {
		return false, err
	}
	regExURI := namedParamRegEx.ReplaceAllString(p.uriPath, `[a-zA-Z0-9]+`) + `/?$`
	return regexp.MatchString(regExURI, path)
}

func (p *namedPath) uri() string {
	return p.uriPath
}
{'fraction_non_alphanumeric': 0.14747307373653687, 'fraction_numerical': 0.0033140016570008283, 'mean_word_length': 4.725118483412322, 'pattern_counts': {'":': 0, '<': 3, '<?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': '5781487', 'n_tokens_mistral': 456, 'n_tokens_neox': 446, 'n_words': 116}