remove the use of Scanner and its test using regular expression instead