refactored using regex
added the first test