Learning a subclass of regular expressions by recognizing periodic repetitions