Community Patterns

Community Library Entry

1

Regular Expression
Created·2016-04-25 18:26
Flavor·Python

r"
(^[\t\s]*)(forgot: "to",)(?!\n[\t\s]*insert: "something",)
"
m
Open regex in editor

Description

Finds a line and appends the replacement below it. Tries to preserve indentation (tabs or spaces) and to avoid duplicate replacements.

I used it in Sublime Text to batch edit several instances of a JS config object across several files.

Submitted by anonymous