It would be helpful to refactor this into a method that we can export for unit testing. Can we add some simple unit tests for the regexp?