-
Notifications
You must be signed in to change notification settings - Fork 8
/
pyregex.py
36 lines (28 loc) · 1.1 KB
/
pyregex.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
import re
file_name = "src\Window Detective.vcxproj"
lineNum = 0
for line in open(file_name):
lineNum += 1
#line = line.strip()
ctr = 0
res = re.search(r"""(.*'Debug\|Win32'">.*?\$\()(QtDir)(\).*)\n""",line, re.IGNORECASE)
res2 = line
if(res != None):
ctr += 1
res2 = re.sub(r"\$\(QTDIR\)",r"$(QTDIRx86)",line, 100, re.IGNORECASE)
res = re.search(r"""(.*'Release\|Win32'">.*?\$\()(QtDir)(\).*)\n""",line, re.IGNORECASE)
if(res != None):
ctr += 1
res2 = re.sub(r"\$\(QTDIR\)",r"$(QTDIRx86)",line, 100, re.IGNORECASE)
res = re.search(r"""(.*'Debug\|x64'">.*?\$\()(QtDir)(\).*)\n""",line, re.IGNORECASE)
if(res != None):
ctr += 1
res2 = re.sub(r"\$\(QTDIR\)",r"$(QTDIRx64)",line, 100, re.IGNORECASE)
res = re.search(r"""(.*'Release\|x64'">.*?\$\()(QtDir)(\).*)\n""",line, re.IGNORECASE)
if(res != None):
ctr += 1
res2 = re.sub(r"\$\(QTDIR\)",r"$(QTDIRx64)",line, 100, re.IGNORECASE)
if(ctr > 1):
print(ctr)
raise Exception("error ctr" )
print(res2, end=" ")