示例#1
0
func (r *Regexp) HasOption(opt int) bool {
	rptr, err := r.validRegexpPtr()
	if err != nil {
		return false
	}

	var i C.uint32_t
	C.pcre2_pattern_info(rptr, C.PCRE2_INFO_ALLOPTIONS, unsafe.Pointer(&i))
	return (uint32(i) & uint32(opt)) != 0
}
示例#2
0
func (r *Regexp) isCRLFValid() bool {
	rptr, err := r.validRegexpPtr()
	if err != nil {
		return false
	}

	var i C.uint32_t
	C.pcre2_pattern_info(rptr, C.PCRE2_INFO_NEWLINE, unsafe.Pointer(&i))
	switch i {
	case C.PCRE2_NEWLINE_ANY, C.PCRE2_NEWLINE_CRLF, C.PCRE2_NEWLINE_ANYCRLF:
		return true
	}

	return false
}