regex solution using scan and join