Skip to content

Instantly share code, notes, and snippets.

@timkaechele
Created September 12, 2014 15:49
Show Gist options
  • Save timkaechele/2984da84803ae9843355 to your computer and use it in GitHub Desktop.
Save timkaechele/2984da84803ae9843355 to your computer and use it in GitHub Desktop.
WhatsApp Export Parser
require 'time'
class WhatsappMessage
def initialize line
@matches = /(\d{2}.\d{2}.\d{2} \d{2}:\d{2}:\d{2}): (.+?): (.+{1,})/.match(line)
end
def date
Time.strptime(@matches[1], "%d.%m.%y %H:%M:%S")
end
def user
@matches[2]
end
def message
@matches[3]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment