Govalidator.v2给出正则表达式错误“未知标签”

I have been trying to understand why some regular expressions give me an error "Unknown tag" while using the validator.v2 package in golang. It works for some regular expressions but does not work with some which have "{}" inside them, and when I use the validator.Validate() it gives me an error at runtime "unknown tag".

Here's the code:

type Company struct {
    Name string `validate:"regexp=^[a-zA-Z .]{1,100}$"` 
}

which gives me the following error at runtime:

Name: unknown tag

however this regex works perfectly fine

type Company struct {
    Name string `validate:"regexp=^[a-zA-Z .]*$"` 
}

I am using the braces because of length restrictions that I want to put on the string. There could be other ways to do it, but I feel the regex is the way to go and is easier to have it along with other rules right there in the expression.

The problem appears to be the , char in your first regex. You can see in the validator source code that the tag is split on ,. By UTSLing, I see no support for escaped commas in the tags; this is probably an oversight on the part of the project author. I suggest filing a bug/feature request.