I7: Replacing within quoted text only

I’m about to run an experiment which would require going through a tremendous quantity of output and replacing something with a text token (e.g. “box” -> “[box]”).

Unfortunately, the words I want to replace also show up with alarming frequency in the actual coding bits.

Does Inform 7 offer a way to either export/import all the text, or search/replace within the output text? (I’m using Windows.)

It’s not hopeless without it, but it would turn a pretty straightforward thing into a slog. Plan B is doing the replacements automatically and then dealing with all the compiler errors that appear, which is a lot of work for an experiment.

I do this kind of thing in a separate editor using regular expression (grep) syntax. You can go to regexr.com if you don’t have a desktop editor with those capabilities. It has a little reference and tooltips, and also does a live preview of your search/replace expression.


What advantage does that give over Cntl+H (or whatever the replace shortcut is?)

The IDE’s replace feature doesn’t let you use regular expressions. Regular expressions allow you to, e.g…, specify that the replacement should take place only when the text to be replaced is found within quotes. So, for example, if you search for this regex:


and replace it with this:

“$1 [box] $2”

then the result of processing

say "There is a box here."

will be

say "There is a [box] here."


Ah, gotcha. That’s very cool. Thanks.

Although that won’t match “You see the box.”

Depending on your regex engine, this might:


I’ll do some experimenting. I’m sure there’s some border cases that will require special handling, but this makes it much faster.