Created
September 12, 2014 15:49
-
-
Save timkaechele/2984da84803ae9843355 to your computer and use it in GitHub Desktop.
WhatsApp Export Parser
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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