Everstack
API ReferenceSandboxGlobal Replace

Global Replace

Find-and-replace across all files under a path inside a sandbox.

Global Replace

Replace a pattern across all files under a path. Supports dry_run mode to preview changes.

POST /v1/sandbox/{sandboxId}/files/global-replace

Request

{
  "path": "/repo",
  "pattern": "oldFunctionName",
  "replacement": "newFunctionName",
  "dry_run": false
}
FieldTypeDescription
pathstringRoot directory to search (default: .)
patternstringPattern to match (supports regex)
replacementstringReplacement string
dry_runbooleanPreview matches without applying (default: false)

Response

{
  "dry_run": false,
  "pattern": "oldFunctionName",
  "replacement": "newFunctionName",
  "path": "/repo",
  "output": "done",
  "exit_code": 0
}

Dry run

Set "dry_run": true to see which lines would be affected without modifying any files. Returns the matching lines in output.

Implementation

Uses perl -pi -e 's/pattern/replacement/g' via find | xargs. Supports regex with capture groups. 60 second timeout.

On this page