-
Notifications
You must be signed in to change notification settings - Fork 0
/
create-regex.py
46 lines (40 loc) · 1018 Bytes
/
create-regex.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import json
def read_file(filename):
'''
This function will read the filename
and return it's content.
'''
with open(filename,'r') as read_file:
data=json.load(read_file)
read_file.close()
return data
def write_file(filename,data):
'''
This function will write data in the filename
and return final content of it.
'''
with open(filename,'w+') as write_file:
json.dump(data, write_file, indent = 4)
write_file.close()
return read_file(filename)
all_regex = [
{"regex":"a*b*"},
{"regex":"qwz*+y"},
{"regex":"028+(99*+85)"},
{"regex":"((2*)*)*"},
{"regex":"0*"},
{"regex":"0*+1*"},
{"regex":"b*a"},
{"regex":"(1+1)"},
{"regex":"1+1"},
{"regex":"1"},
{"regex":"0"},
{"regex":"b"},
{"regex":"a"},
{"regex":""},
{"regex":"(a+b)*+ba+c*"},
{"regex":"(1+0*0(1+0))*1+0"},
]
for i in range(len(all_regex)):
cd = all_regex[i]
write_file(f"./regular-expression/{i}.txt",cd)