O
7

Regex made me lose my whole config, now I keep an oops folder

Last Tuesday I was messing with a config file for a little Python script I've been learning with, and I thought I'd be clever and use regex to swap out a few lines. I wrote this pattern that looked fine in my head, ran it, and poof, it matched way more than I wanted. It stripped out like 40 lines of settings, including the ones that made the script talk to our local weather station. I didn't have a backup because I figured I'd only change a couple of keys, and I spent an hour trying to remember what the original values were. I finally had to rewrite the whole thing from scratch, which actually taught me more about the script than I knew before. Now I keep a copy of any file I'm about to touch in a folder called "oops" and I test regex on a tiny sample string first. Has anyone else had a regex or find-and-replace go rogue on them, and did you manage to recover or just rebuild?
1 comments

Log in to join the discussion

Log In
1 Comment
nancy820
nancy82020d ago
Regex giveth, regex taketh away. Oops folder is the new holy grail.
5