import re
strings = [
'[ex.endermen](profile_url1) got killed by [og.[(Z)]arcus(0.43k/d)](profile_url2) (FN Evolys, 56.83m)',
'[ex.endermen](profile_url1) got killed by [platina](profile_url2) (FN Evolys, 56.83m)'
]
regex = r'^\[(?P<name1>.+?)\]\((?P<name1_url>.+?)\).+?\[(?P<name2>.+)\]\((?P<name2_url>.+?)\)'
string_parser = re.compile(regex)
for string in strings:
print(string_parser.match(string).groupdict())
{'name1': 'ex.endermen', 'name1_url': 'profile_url1', 'name2': 'og.[(Z)]arcus(0.43k/d)', 'name2_url': 'profile_url2'}
{'name1': 'ex.endermen', 'name1_url': 'profile_url1', 'name2': 'platina', 'name2_url': 'profile_url2'}
text = '[ex.endermen](profile_url1) got killed by [og.[(Z)]arcus(0.43k/d)](profile_url2) (FN Evolys, 56.83m)'
name1 = text[text.find('[')+1:text.find(']')]
profile_url1 = text[text.find('(')+1:text.find(')')]
profile_url2 = text[text.rfind('(', 0, text.rfind('('))+1: text.find(') (')]
name2 = text[text.find('[', text.find(']'))+1: text.rfind(']')]
weapon = text[text.rfind('(',)+1: text.rfind(')')].split(',')[0]
print(name1)
print(profile_url1)
print(profile_url2)
print(name2)
print(weapon)
if letter_func(str) == '':
big_nmbr(str)
def big_nmbr(string):
try:
lst = string.split('.')
lst = [int(i) for i in lst]
nw_lst = []
for num in lst:
if num > 255:
nw_lst.append(num)
return nw_lst
except ValueError:
return []