Removed unnecessary tests. Slightly improved regex.