Ad
  • Custom User Avatar

    That's what I've been doing! I said in my question that adding debug logging is exactly what I've been doing. But when I put debug logging in, the test changes, so that when I get code that should solve that problem, suddenly the problem to be solved is different and my code doesn't work. (I know this because the expected output is now completely different!)

  • Custom User Avatar

    Regex is overkill for anything.

    If it's a very simple parse, like this, you'll get better performance and code that's easier to read by just writing it out imperatively. If it's a complicated parse, you'll be less likely to run into bugs, and have code that's easier to read, by using a proper parser DSL such as ANTLR. Regex isn't particularly good at either case, and its complexlity is extremely high. The "now you have two problems" joke exists for a reason.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution