2. Write a program for generating regular expressions for regular grammar
Output:
['ab', 'abb', 'a', 'abbb']
import re
# '*' replaces the no. of occurrence # of a character. p = re.compile('ab*') print(p.findall("ababbaabbb")) |
Output:
['ab', 'abb', 'a', 'abbb']
No comments