alphagov/specialist-publisher — pull request #64 by bestie (2014-03-27 17:17:25+00:00)
Title: Implementation of string replace without regex

As far as I can tell this is the only way to do string replacement without getting the Regex engine involved.

Motivation is that the attachment title could possibly contain `\\'` which has the following effect when used with `gsub`

```
pry(main)> "all of the things".gsub("all of", "most \\' of")
=> "most the things of the things"
```

`Regexp.escape` isn't a great option as it escapes spaces.

The other options I can see are
* Use `Regexp.escape` and unescape the spaces (another layer of gsubbing)
* Don't allow `\\'` in the attachment title

The last option there raised the question of what else shouldn't we allow?