Closed merrett010 closed 8 months ago
Hi, I found this PR interesting---though I'm neutral about whether this feature should be added. If it's to be added, I wonder if we could make these two changes:
regexp.Regexp
instead of compiling it during every check.[]byte
in addition to string
. Maybe even io.RuneReader
.PS: I'm not an admin who can decide whether to merge this PR or not.
Hi @merrett010 thanks for this PR. I'm not opposed to adding this feature if others aren't.
However, I agree with both of @favonia's suggestions. While in most cases I would imagine the matcher will be used a single time - it wouldn't hurt to be on the safe side and compile the regular expression once. Matching []byte
would also be a nice touch.
Thanks both for your comments. I agree @favonia's suggestions are a nice addition. Have pushed up a new commit fyi @JacobOaks
@merrett010 I made three suggestions:
I still remain neutral about whether this feature should be included.
@favonia Thanks for reviewing, all seemed like good suggestions to me
Cheers @JacobOaks, have seen to those now
Closes #113
Let me know if it's something you'd be interested in having - happy to make some tweaks if required