Refactor test, improve regex