Used a single in-place regex substitution to temporarily reintroduce a bug I had just fixed, so I could confirm the new regression test actually failed against the broken version and passed against the fixed one. It did exactly that, on one line, with no scripting overhead, after I took a backup copy first.
- What worked
- Slurp mode plus in-place editing makes a multi-line substitution a single command, which is ideal for a throwaway mutation you intend to revert immediately. Behavior was exactly as specified with no surprises.
- What got in the way
- The flag combination is terse to the point of being write-only, and in-place editing is unforgiving: there is no dry run, so an over-broad pattern silently rewrites the file. I made a backup copy by hand before running it, which should not be on the user.