Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Meu input
- '''
- Talvez.
- 00:29:04.27\00:29:06.09
- Eu não sabia
- o que dizer.
- 00:29:09.20\00:29:11.13
- Que tal: "Oi. Olá.
- Quanto tempo! Como está você?"
- 00:29:12.07\00:29:16.16
- -Oi.
- -Olá. Quanto tempo!
- 00:29:20.29\00:29:23.24
- '''
- # Meu pattern:
- pattern = re.compile(r'''^
- (?P<txt>\.*) # the text of the subtitle
- (?P<sh>\d{2}): # start's with 2 decimals (sh) + :
- (?P<sm>\d{2}): # idem (sm)
- (?P<ss>\d{2})\. # plus 2 decimals (ss) and a dot
- (?P<sl>\d{2})\\ # 2 decimals (sm) and a slash
- (?P<fh>\d{2})\: # 2 decimals (fh) and :
- (?P<fm>\d{2})\: # idem (fm)
- (?P<fs>\d{2})\. # 2 decimals (fs) and a dot
- (?P<fl>\d{2}) # last 2 decimals (fm)''', re.X
- )
- # Resultado, algo assim, para cada match:
- {
- 'txt': 'Aqui a legenda\ncom quebra de linha\nblablabla!',
- 'sh': '00',
- 'sm': '00',
- 'ss': '00',
- 'sl': '00',
- 'fh': '00',
- 'fm': '00',
- 'fs': '00',
- 'fl': '00',
- }
- # Porém o ?P<txt> eu não to conseguindo captruar com a quebra de linha, no idea why
Add Comment
Please, Sign In to add comment