Skip to content

(:replace-in) - Operators ​

replace region matched by a pattern

clojure
(:replace-in val sub?)

Where:

  1. val: value to replace *
  2. sub: replacement text (omit to empty the region) *

Expanding into:

clojure
(:#replace region \1 \2)

Guides ​

Behavior ​

  • Similar to (:replace) only that it operates on a specific region and not the entire node.

Examples ​

Replace all instances of a deprecated API call with its modern equivalent.

clojure
(call (:replace-in /_sync$/ "Sync"))

Selects in lines { 1 }:

typescript
readFile_sync()
readFile()

Arguments ​

val ​

  1. inherit

sub ​

  1. String

Does NOT support: Composition — Free-form Selection — Refinement — Replacement

Copyright © 2022-present Semantic Works, Inc.