Bounded wildcard matching
GlobHaven brings pattern-matching code into a focused Windows workspace. Discuss the supported wildcard grammar with a compatible model and review its implementation against full-string and Unicode cases.
def wildcard(text, pattern):
if not isinstance(text, str) or not isinstance(pattern, str):
raise ValueError("text.required")
if len(text) > 256 or len(pattern) > 256:
raise ValueError("length.cap")
if any(ord(c) in (91, 93, 92) for c in pattern):
raise ValueError("syntax.unsupported")
previous = [True] + [False] * len(pattern)
for j, token in enumerate(pattern, 1):
previous[j] = token == "*" and previous[j - 1]
for char in text:
current = [False] * (len(pattern) + 1)
for j, token in enumerate(pattern, 1):
current[j] = (current[j - 1] or previous[j]) if token == "*" else (
previous[j - 1] and (token == "?" or token == char))
previous = current
return previous[-1]| Project | Check empty strings, consecutive stars and emoji, rejecting bracket or backslash syntax rather than interpreting unsupported pattern rules. |
|---|---|
| Review before applying | Compare actual behavior with the expected result. If a check fails, investigate it before applying more changes. |
| Connection | Base URL, credentials and a reachable server. |
def wildcard(text, pattern):
if not isinstance(text, str) or not isinstance(pattern, str):
raise ValueError("text.required")
if len(text) > 256 or len(pattern) > 256:
raise ValueError("length.cap")
if any(ord(c) in (91, 93, 92) for c in pattern):
raise ValueError("syntax.unsupported")
previous = [True] + [False] * len(pattern)
for j, token in enumerate(pattern, 1):
previous[j] = token == "*" and previous[j - 1]
for char in text:
current = [False] * (len(pattern) + 1)
for j, token in enumerate(pattern, 1):
current[j] = (current[j - 1] or previous[j]) if token == "*" else (
previous[j - 1] and (token == "?" or token == char))
previous = current
return previous[-1]Give search syntax a contract users can understand
GlobHaven provides a Windows coding workspace for turning a matching requirement into a reviewable software change. Begin with the input users type and the results they expect. A request about search syntax should identify supported operators and failure behavior before the connected model proposes a parser or rewrites the matching code.
The bounded wildcard example supplies one possible project discussion: matching a complete string with a deliberately limited grammar. Bring examples of patterns your application accepts and rejects, and ask the assistant to inspect how those rules reach the interface. This keeps a change to one operator from silently promising a much larger search language.
Review the proposed code together with messages and validation at the caller. Test empty input, ordinary characters and combinations of supported wildcards using your own fixtures. Include a case that distinguishes complete-string matching from finding a substring, then check the visible search behavior in the application before relying on the implementation.
An unfiltered AI model may assist if your supported OpenAI-compatible or Anthropic endpoint offers it. Set up the connection with credentials when required and check its tools and context limits. GlobHaven supplies the project workspace; model behavior remains service-dependent, and you decide which proposed syntax belongs in your product.
Before extending a matching feature
How do I describe matching behavior without naming an algorithm?
Provide pattern-and-input pairs with expected true or false results. State whether the whole string must match and which symbols are special. Those examples give the model a clear contract without prescribing an implementation you may not need.
Should unsupported syntax be treated as literal text?
Choose that behavior explicitly for the application. If it should be rejected, include the expected error path and message. Ask the assistant to preserve that choice rather than quietly expanding grammar because another matcher supports more operators.
What demonstrates the difference between substring and full matching?
Use an input with extra characters before or after an otherwise matching part and state the expected result. Test the same case through the interface, since the caller might transform either the pattern or the input.
Will an added wildcard affect existing saved searches?
It can if previously literal text receives a new meaning. Identify stored patterns and their interpretation before changing syntax. Review compatibility examples with the proposed code and decide how existing searches should behave after the change.
GlobHaven · Updated 2026-10-25