func (spb *stylePolicyBuilder) Matching(regex *regexp.Regexp) *stylePolicyBuilder {
	spb.regexp = regex
	return spb
}
Matching allows a regular expression to be applied to a nascent style
policy, and returns the style policy.
package bluemonday
import (
	"net/url"
	"regexp"
	"strings"
	"github.com/microcosm-cc/bluemonday/css"
)
type Policy struct {
	initialized bool
	addSpaces bool
	requireNoFollow bool
	requireNoFollowFullyQualifiedLinks bool
	requireNoReferrer bool
	requireNoReferrerFullyQualifiedLinks bool
	requireCrossOriginAnonymous bool
	addTargetBlankToFullyQualifiedLinks bool
	requireParseableURLs bool
	allowRelativeURLs bool
	allowDataAttributes bool
	allowComments bool
	elsAndAttrs map[string]map[string][]attrPolicy
	elsMatchingAndAttrs map[*regexp.Regexp]map[string][]attrPolicy
	globalAttrs map[string][]attrPolicy
	elsAndStyles map[string]map[string][]stylePolicy
	elsMatchingAndStyles map[*regexp.Regexp]map[string][]stylePolicy
	globalStyles map[string][]stylePolicy
	allowURLSchemes map[string][]urlPolicy
	setOfElementsAllowedWithoutAttrs map[string]struct{}
	setOfElementsMatchingAllowedWithoutAttrs []*regexp.Regexp
	setOfElementsToSkipContent map[string]struct{}
}
type attrPolicy struct {
	regexp *regexp.Regexp
}
type stylePolicy struct {
	handler func(string) bool
	regexp *regexp.Regexp
	enum []string
}
type attrPolicyBuilder struct {
	p *Policy
	attrNames  []string
	regexp     *regexp.Regexp
	allowEmpty bool
}
type stylePolicyBuilder struct {
	p *Policy
	propertyNames []string
	regexp        *regexp.Regexp
	enum          []string
	handler       func(string) bool
}
type urlPolicy func(url *url.URL) (allowUrl bool)
func (p *Policy) init() {
	if !p.initialized {
		p.elsAndAttrs = make(map[string]map[string][]attrPolicy)
		p.elsMatchingAndAttrs = make(map[*regexp.Regexp]map[string][]attrPolicy)
		p.globalAttrs = make(map[string][]attrPolicy)
		p.elsAndStyles = make(map[string]map[string][]stylePolicy)
		p.elsMatchingAndStyles = make(map[*regexp.Regexp]map[string][]stylePolicy)
		p.globalStyles = make(map[string][]stylePolicy)
		p.allowURLSchemes = make(map[string][]urlPolicy)
		p.setOfElementsAllowedWithoutAttrs = make(map[string]struct{})
		p.setOfElementsToSkipContent = make(map[string]struct{})
		p.initialized = true
	}
}
func NewPolicy() *Policy {
	p := Policy{}
	p.addDefaultElementsWithoutAttrs()
	p.addDefaultSkipElementContent()
	return &p
}
func (p *Policy) AllowAttrs(attrNames ...string) *attrPolicyBuilder {
	p.init()
	abp := attrPolicyBuilder{
		p:          p,
		allowEmpty: false,
	}
	for _, attrName := range attrNames {
		abp.attrNames = append(abp.attrNames, strings.ToLower(attrName))
	}
	return &abp
}
func (p *Policy) AllowDataAttributes() {
	p.allowDataAttributes = true
}
func (p *Policy) AllowComments() {
	p.allowComments = true
}
func (p *Policy) AllowNoAttrs() *attrPolicyBuilder {
	p.init()
	abp := attrPolicyBuilder{
		p:          p,
		allowEmpty: true,
	}
	return &abp
}
func (abp *attrPolicyBuilder) AllowNoAttrs() *attrPolicyBuilder {
	abp.allowEmpty = true
	return abp
}
func (abp *attrPolicyBuilder) Matching(regex *regexp.Regexp) *attrPolicyBuilder {
	abp.regexp = regex
	return abp
}
func (abp *attrPolicyBuilder) OnElements(elements ...string) *Policy {
	for _, element := range elements {
		element = strings.ToLower(element)
		for _, attr := range abp.attrNames {
			if _, ok := abp.p.elsAndAttrs[element]; !ok {
				abp.p.elsAndAttrs[element] = make(map[string][]attrPolicy)
			}
			ap := attrPolicy{}
			if abp.regexp != nil {
				ap.regexp = abp.regexp
			}
			abp.p.elsAndAttrs[element][attr] = append(abp.p.elsAndAttrs[element][attr], ap)
		}
		if abp.allowEmpty {
			abp.p.setOfElementsAllowedWithoutAttrs[element] = struct{}{}
			if _, ok := abp.p.elsAndAttrs[element]; !ok {
				abp.p.elsAndAttrs[element] = make(map[string][]attrPolicy)
			}
		}
	}
	return abp.p
}
func (abp *attrPolicyBuilder) OnElementsMatching(regex *regexp.Regexp) *Policy {
	for _, attr := range abp.attrNames {
		if _, ok := abp.p.elsMatchingAndAttrs[regex]; !ok {
			abp.p.elsMatchingAndAttrs[regex] = make(map[string][]attrPolicy)
		}
		ap := attrPolicy{}
		if abp.regexp != nil {
			ap.regexp = abp.regexp
		}
		abp.p.elsMatchingAndAttrs[regex][attr] = append(abp.p.elsMatchingAndAttrs[regex][attr], ap)
	}
	if abp.allowEmpty {
		abp.p.setOfElementsMatchingAllowedWithoutAttrs = append(abp.p.setOfElementsMatchingAllowedWithoutAttrs, regex)
		if _, ok := abp.p.elsMatchingAndAttrs[regex]; !ok {
			abp.p.elsMatchingAndAttrs[regex] = make(map[string][]attrPolicy)
		}
	}
	return abp.p
}
func (abp *attrPolicyBuilder) Globally() *Policy {
	for _, attr := range abp.attrNames {
		if _, ok := abp.p.globalAttrs[attr]; !ok {
			abp.p.globalAttrs[attr] = []attrPolicy{}
		}
		ap := attrPolicy{}
		if abp.regexp != nil {
			ap.regexp = abp.regexp
		}
		abp.p.globalAttrs[attr] = append(abp.p.globalAttrs[attr], ap)
	}
	return abp.p
}
func (p *Policy) AllowStyles(propertyNames ...string) *stylePolicyBuilder {
	p.init()
	abp := stylePolicyBuilder{
		p: p,
	}
	for _, propertyName := range propertyNames {
		abp.propertyNames = append(abp.propertyNames, strings.ToLower(propertyName))
	}
	return &abp
}