I’m currently working with some chat messages from WhatsApp and I need to split them in a way that allows me to use them for other applications. These messages are plain text and follow a specific pattern.
Everything is going well, except for when users include new lines, such as when they send more detailed messages. This results in new lines within the message.
Thus, I require a pattern that can join these lines that do not match my desired pattern.
Currently, I’m iterating over the lines and using a REGEX pattern at the beginning of each line to determine if it’s valid or not.
However, the issue I’m encountering is that I’m unable to join them properly.
The desired out put would be in the line 5 joined with next lines until the next pattern is matched.
[31/08/2020, 15:07:29] Paulo Bombinhas: Temos sim. Precisamos ver com o condomínio boulevard como vai ficar para reservar. Semana passada quando falei com eles dissseram que até então a capacidade de ocupação dos aptos está em 50% ou seja apenas 3 pessoas por apartamento
[31/08/2020, 15:08:41] Maria: Deste jeito não alugara né
[31/08/2020, 15:12:21] Paulo Bombinhas: Com essa taxa de ocupação fica bem difícil alugar. Mas acredito que para o verão já esteja normalizado
[10/09/2020, 11:04:25] Maria: Eu te passo
[11/09/2020, 10:45:21] Maria: administradora de Bens Ltda
36572992/0001-79
Caixa 104
Agência 4111
C/ C 245551-7 operação 005511
[15/09/2020, 06:36:31] Paulo Bombinhas: Bom dia Maria. Hoje vou passar o dia com a Livia para terminar o relatório e caso haja pendências já acertarmos também. Preciso entrar em contato por telefone também, me avise o melhor horário por favor.
[15/09/2020, 08:07:58] Maria: Bom dia Paulo. Que ótimo!