stream_editor: stream editor

View source: R/stream-editor.R

stream_editorR Documentation

stream editor

Description

R equivalent of GNU-sed

Usage

stream_editor(raw_lines, pattern, target, replacement)

Arguments

raw_lines

a vector of readLines from the file

pattern

a regex pattern to match

target

target string to be replaced

replacement

replacement string to be substituted

Value

raw_lines : modified vector of lines

Examples

example_string <- "\\target{} \\not_a_target{}"
texor::stream_editor(example_string,"\\s*\\\\target\\{\\}", "\\\\target", "\\\\hit")

texor documentation built on April 4, 2025, 4:44 a.m.