So opening a file each time user tries to sign up, going through each line of the file that gets bigger every day and doing regex match against each line? OK, I see you didn't write anything at scale.
You know you can just keep the file open, right? You don't have to open and close it for every user.
You're not matching regex against every line. Read the last code block carefully. You're creating one regex that matches every line in the file simultaneously.
Redoing it isn't going to change much whether it's 5 lines or 5000 lines? I would just implement a version to load them from a file (or database). Then just copy the 5000 lines into vim, and then do some fancy search and replace, or create a macro. Really it shouldn't take more than a few minutes to change them from this format into a file format, and the actual implementation of loading from a file is going to take the same amount of time regardless of the number (excluding stupidly high numbers of course).
8
u/[deleted] Oct 07 '21
I imagine this started with like 10 lines and they just kept adding to it. Now it got to a point where redoing it is just not worth it.