Generate regex as promise