MCPcopy Create free account
hub / github.com/PostHog/duckgres / patternHasCaptureGroup

Function patternHasCaptureGroup

transpiler/transform/functions_compat.go:322–333  ·  view source on GitHub ↗

patternHasCaptureGroup reports whether a regex literal contains an unescaped capturing '(' (i.e. '(' not preceded by '\' and not the start of '(?').

(p string)

Source from the content-addressed store, hash-verified

320// patternHasCaptureGroup reports whether a regex literal contains an unescaped
321// capturing '(' (i.e. '(' not preceded by '\' and not the start of '(?').
322func patternHasCaptureGroup(p string) bool {
323 for i := 0; i < len(p); i++ {
324 if p[i] == '\\' {
325 i++
326 continue
327 }
328 if p[i] == '(' && (i+1 >= len(p) || p[i+1] != '?') {
329 return true
330 }
331 }
332 return false
333}
334
335// intervalReturningFuncs are compat/native functions whose result is an INTERVAL,
336// used to recognise a provably-interval argument to isfinite().

Callers 1

handleSubstringMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected