Prototype solution with Python and regex before moving on to Node implementation