This is mildly inefficient as you're throwing the compiled pattern away each time.