Replaced length test with regex