Regex to match whatsapp chat log
I've been trying to create Regex for WhatsApp chat log. So far I've been able to achieve this Click Here for the test link By creating the following Regex: (?P<datetime>\d{2}\/\d{2}\/\d{4},\s\d(?:\d)?:\d{2} [pa].m.)\s-\s(?P<name>[^:]*):(?P<message>.*) The problem with this regex is, it is not able to match big messages which span multiple lines with line breaks. You can see the issue in the link provided above. Help would be appreciated. Thank you. There you go: ^ (?P<datetime>\d{2}/\d{2}/\d{4}[^-]+)\s+-\s+ (?P<name>[^:]+):\s+ (?P<message>[\s\S]+?) (?=^\d{2}|\Z) See your modified demo on