# Sequence of replace in text files

**URL:** <https://discourse.julialang.org/t/sequence-of-replace-in-text-files/11802>\
**Category:** General Usage\
**Tags:** strings\
**Created:** [June 20, 2018, 12:40am UTC](https://discourse.julialang.org/t/sequence-of-replace-in-text-files/11802 "2018-06-20T00:40:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tlienart](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tlienart/32/7640_2.png) [@tlienart](https://discourse.julialang.org/u/tlienart)\
**Post date:** [June 20, 2018, 12:40am UTC](https://discourse.julialang.org/t/sequence-of-replace-in-text-files/11802/1 "2018-06-20T00:40:04Z")

</div>

I’m writing a “converter” for files which takes a file (say `f1`) and outputs a file (say `g1`) after having done a bunch of `replace`. Each file is likely to be reasonably short (\< 1mb) but there are potentially many files to go over so processing speed is reasonably important.

I was wondering whether there are recommendations to improve something that effectively looks like:

```julia
s = readstring(f1)
for pp in pat_pairs
  s = replace(s, pp)
end
write(g1, s)

```

where `pat_pairs` is a list of regex-replacement pairs.
