Removed puts and tidied up regex