メモ:正規表現でreplacement functionを使いたいときはbaseの関数が便利っぽい

formatRのコードを読んでいると、こんな箇所がありました。 m = gregexpr(mat.comment, text.mask) regmatches(text.mask, m) = lapply(regmatches(text.mask, m), restore_bs) (https://github.com/yihui/formatR/blob/022da8c1be2c04c8374d19907c41bacd5d0ecfcc/R/tidy.R#L107-L108)