pub fn remove_timestamps(text: &str) -> Cow<'_, str>
Expand description
Parse text for timestamps and IDs and remove them, returning the modified text without making a copy.
Some compromises are made to be able to remove timestamps in between other symbols e.g. ‘/83421321/’. but still avoid removing commit SHAs. That means that these symbols are also removed (any non-letter character preceding and following an ID).
§Example
let test_str = r"ID 21442749267 ";
let modified = remove_timestamps(test_str);
assert_eq!(modified, "ID"); // Note that the space is removed
let test_str = r#"ID 21442749267
date: 2024-02-28 00:03:46
other text"#;
let modified = remove_timestamps(test_str);
assert_eq!(modified, "IDdate: \nother text");