ADDED:
* netx.IsPub
* encodingx/hexx

Rest are mostly small corrections and docs
This commit is contained in:
brent saner
2026-06-22 18:51:13 -04:00
parent c6fc692f5e
commit 58556d7281
35 changed files with 5492 additions and 2486 deletions
+57
View File
@@ -0,0 +1,57 @@
- write a flag parser/converter for github.com/scorpionknifes/go-pcre (and github.com/GRbit/go-pcre) :
----
// i CASELESS
// m MULTILINE
// s DOTALL
// x EXTENDED
// U UNGREEDY
// 8 UTF8 (non-standard flag letter; standard PCRE uses (*UTF8) outside (?...) syntax)
//
// Flags after a '-' inside group disable associated flag and are ignored
// (applies inside the regex engine once prefix is stripped).
// pattern, flags := ParsePrefixFlags(`(?im)^hello`)
// re := pcre.MustCompile(pattern, flags)
func ParsePrefixFlags(pattern string) (string, int) {
if !strings.HasPrefix(pattern, "(?") {
return pattern, 0
}
end := strings.IndexByte(pattern, ')')
if end < 0 {
return pattern, 0
}
inner := pattern[2:end] // everything between "(?" and ")"
for _, ch := range inner {
if !strings.ContainsRune("imsxU8-", ch) {
return pattern, 0
}
}
positive := inner
if dash := strings.IndexByte(inner, '-'); dash >= 0 {
positive = inner[:dash]
}
var flags int
for _, ch := range positive {
switch ch {
case 'i':
flags |= pcre.CASELESS
case 'm':
flags |= pcre.MULTILINE
case 's':
flags |= pcre.DOTALL
case 'x':
flags |= pcre.EXTENDED
case 'U':
flags |= pcre.UNGREEDY
case '8':
flags |= pcre.UTF8
}
}
return pattern[end+1:], flags
}
----