Skip to content

Add -e/--regex opt-in mode — triggers v2.0.0 release #38

@dolph

Description

@dolph

Goal

Add a -e / --regex flag that treats the pattern as a regex (RE2 syntax) instead of a literal string. Capture groups in the replacement work via the standard $1, ${name} syntax.

find-replace -e '(\w+)_test\.go' '$1.test.go'
find-replace -e 'github\.com/old/(\w+)' 'github.com/new/$1'

Default stays literal

Literal mode remains the default. Switching the default to regex would silently break any existing invocation whose pattern contains ., +, *, ?, (, [, \, etc. — that's most real-world patterns (filenames, version strings, URLs). Opt-in keeps every existing script working.

Why this triggers a major release (v2.0.0)

Even though the default doesn't change, this is the natural breakpoint for the regex feature set:

  • New flag surface (-e/--regex) and new replacement syntax ($1, ${name}, $$)
  • Combined with the prerequisites below, this is a substantial expansion of what the tool does
  • v2.0.0 gives a clean documentation cut and a clear "before/after" for users reading the README

The major bump is more about communicating the scope of new capabilities than about breaking changes.

Depends on (must land first)

Acceptance

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions