reference:
|
fn link_to_medium(link: &String) -> String { |
|
let re = Regex::new(r"https?://medium.com/(.+)/.+").unwrap(); |
|
re.replace_all(&link, "medium.com/$1").to_string() |
|
} |
converts link https://medium.com/the-innovation/3-toxic-relationship-habits-people-think-are-acceptable-1ec04dfcc729 to medium.com/the-innovation
reference:
this_week_in_rust.rs/src/types.rs
Lines 56 to 59 in 7eb6608
converts link
https://medium.com/the-innovation/3-toxic-relationship-habits-people-think-are-acceptable-1ec04dfcc729tomedium.com/the-innovation