Mar-28-2020, 06:01 PM
Hello, I have started learning python via documentation & videos because I trying to make a program that converts episode number and timestamps in a .txt to an XML chapter file.
Write now I am trying to take the raw episode raw format and output 1 or 2 numbers and groups 6 is giving me
s or suggestions would be great.
Write now I am trying to take the raw episode raw format and output 1 or 2 numbers and groups 6 is giving me
There was no Match when it should be saying 6 is a match. I don't know if I`m going about this the right way, so any
s or suggestions would be great. import re
Input = 'd7 23'
###Input should output 23 via groups 2 or 3 or 6
##Input = '23'
##Input = 'ep23'
ep_regex = '((?i)EP(\d\d?))?(^\d\d?$)?(((?i)d\w[\s|:])?(\d\d?))?'
ep_prog = re.compile(ep_regex)
ep_result = ep_prog.match(Input)
one = ep_result.group(1)
two = ep_result.group(2)
three = ep_result.group(3)
four = ep_result.group(4)
five = ep_result.group(5)
six = ep_result.group(6)
if two or three or six is True:
if two == None:
print('No match in G2')
pass
else:
print('2 is a Match!')
if three == None:
print('no match in G3')
pass
else:
print('3 is a Match!')
if six == None:
print('No Match in G6')
pass
else:
print ("6 is a match!")
else:
print("There was no Match")
print('group 1 -->',one)
print('group 2 -->',two)
print('group 3 -->',three)
print('group 4 -->',four)
print('group 5 -->',five)
print('group 6 -->',six)Here`s the error that I WAS getting if that helps.Error:Warning(from warnings module):
File "C:\Users\new user\Desktop\py read & replace\Regex_Examples\ep_re_group_match.py", line 9
ep_prog = re.compile(ep_regex)
DeprecationWarning: Flags not at the start of the expression '((?i)EP(\\d\\d?))?(^\\d' (truncated)
