From 49dd5dfc48d6199d919bde93c7e16a012b4e5fb1 Mon Sep 17 00:00:00 2001 From: Willem van den Ende Date: Thu, 13 Apr 2023 08:20:09 +0200 Subject: [PATCH] match hours ago with line --- mostalive/convert-chats-to-org.el | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/mostalive/convert-chats-to-org.el b/mostalive/convert-chats-to-org.el index f45f6c4..4853097 100644 --- a/mostalive/convert-chats-to-org.el +++ b/mostalive/convert-chats-to-org.el @@ -5,15 +5,15 @@ (interactive) (save-excursion (goto-char (point-min)) - (while (re-search-forward (rx (one-or-more (category digit))) nil t) - (replace-match "dada")))) + (while (re-search-forward "[0-9]+ hours ago" nil t) + (replace-match "")))) (ert-deftest test-chat-remove-hours-ago () (should (string= (with-temp-buffer - (insert "17") + (insert "17 hours ago") (goto-char (point-min)) (chat-remove-hours-ago) (buffer-string)) @@ -21,7 +21,8 @@ (ert-deftest test-replace-hours-ago-regexp-in-string () (should (string= - (replace-regexp-in-string "[0-9]+ hours ago" "" "11 hours ago") + (replace-regexp-in-string "[0-9]+ hours ago" "" "space 11 hours ago") ""))) (ert 'test-replace-regexp-in-string ) +;;(ert 'test-chat-remove-hours-ago )