func (p Pattern) IsValid() bool {
	if len(p) == 0 {
		return true
	}
	start := true
	alone := false
	emptytag := false
	for i, c := range p {
		if c == '.' {
			if start || emptytag {
				return false
			}
			alone = false
			start = true
		} else {
			if alone || c < 33 || c > 126 || c == '?' {
				return false
			}
			switch c {
			case '>':
				if !start || i < len(p)-1 {
					return false
				}
			case '*':
				if !start {
					return false
				}
				alone = true
			case '$':
				if start {
					emptytag = true
				}
			default:
				emptytag = false
			}
			start = false
		}
	}
	return !(start || emptytag)
}
IsValid returns true if the pattern is valid, otherwise false.
package res
type Pattern string