Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the pattern work with more WhatsApp Versions #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

JECaballeroR
Copy link

I changed the regex Patter in the Android version to
pattern = '^([0-9]+)(\/)([0-9]+)(\/)([0-9]+),? ?([0-9]+):([0-9]+) ?(AM|PM|am|pm|p. m.|a. m.|a.m.|p.m.)? ?-? ?'

which will detect more version that I encountered.

Also, due to sometimes the a.m and p.m elements having spaces, i used a slight modification of the getDataPoints Function (not in the pull request as still a WIP):

def getDataPoint(line):   
    splitLine = line.split(' - ') 
    dateTime = splitLine[0]
    dateTime=dateTime.replace(',', '')
    date_time = dateTime.split(' ') 
    date = date_time[0]
    time =' '.join(date_time[1:]).replace('. m', '.m')
    message = ' '.join(splitLine[1:])
    if FindAuthor(message): 
        splitMessage = message.split(': ') 
        author = splitMessage[0] 
        message = ' '.join(splitMessage[1:])
    else:
        author = None
    return date, time, author, message

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant