JustUtahCoders / utahexpungements.org

The frontend code for utahexpungements.org
MIT License
11 stars 19 forks source link

Restructured file with a lot of regex #220

Closed HappyViki closed 3 years ago

HappyViki commented 4 years ago

Issue: https://github.com/JustUtahCoders/utahexpungements.org/issues/174

Problem: Parser doesn't always parse what's needed.

Solution: Completely restructure the parsing file to use mostly just Regex.

Before:

  1. File would parse line by line
  2. Use minimal regex to determine how to display info in line

After:

  1. File parses in chunks based on regex
  2. Iterates over multiple similar chunks
  3. Uses a lot of regex to refine search on those chunks

Note: I wanted to add some extra stuff, but I feel like it's best to push something that works, rather than try and perfect it. I modified the test a bit. My code passes the test now. I would still like someone to review with me and make sure I've covered all the defaults. I'm afraid that not everything has been covered in the test, and so I may have missed something.