regextool

package
v0.1.8-rc.21 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 28, 2026 License: Apache-2.0 Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package regextool provides regular expression tools for agents. LLMs are notoriously unreliable at generating and reasoning about regex patterns — this tool lets them test, match, extract, and replace using Go's regexp engine for precise results.

Problem: Agents need to parse structured text (log files, configs, code) and LLMs cannot reliably execute regex operations mentally. This package provides a deterministic regex engine the agent can call.

Safety guards:

  • Input capped at 1 MB to prevent excessive processing
  • Pattern length capped at 10,000 chars
  • Output truncated at 32 KB to limit LLM context consumption
  • Go's RE2 engine guarantees linear-time matching (no catastrophic backtracking)

Dependencies:

  • Go stdlib only (regexp uses RE2 — guaranteed linear-time, no backtracking)
  • No external system dependencies

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ToolProvider

type ToolProvider struct{}

ToolProvider wraps the regex tool and satisfies the tools.ToolProviders interface.

func NewToolProvider

func NewToolProvider() *ToolProvider

NewToolProvider creates a ToolProvider for the regex tool.

func (*ToolProvider) GetTools

func (p *ToolProvider) GetTools(_ context.Context) []tool.Tool

GetTools returns the regex tool.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL