Move code to RegexpSample#generate