| Crates.io | mentions-hashtags |
| lib.rs | mentions-hashtags |
| version | 0.1.0 |
| created_at | 2025-07-20 15:36:55.792238+00 |
| updated_at | 2025-07-20 15:36:55.792238+00 |
| description | Extracts @mentions and #hashtags from text (like social media descriptions). Built in safe, fast, idiomatic Rust using regex. |
| homepage | https://github.com/rocketnozzle/mentions-hashtags-rs |
| repository | https://github.com/rocketnozzle/mentions-hashtags-rs |
| max_upload_size | |
| id | 1761196 |
| size | 15,901 |
Extracts @mentions and #hashtags from text (like social media descriptions). Built in safe, fast, idiomatic Rust using regex.
@MrBeast, @DiorOfficial)#fyp, #LouisVuitton)_, -, .)use mentions_hashtags::mentions_hashtags::*;
let input = "@charlidamelio @GucciOfficial just posted! #fyp #CapCut #Chanel";
let result = parse_mentions_hashtags(input, true, true).unwrap();
assert_eq!(result.mentions, vec!["@charlidamelio", "@GucciOfficial"]);
assert!(result.hashtags.contains(&"#fyp".to_string()));
assert!(result.hashtags.contains(&"#Chanel".to_string()));
parse_mentions_hashtags(description, mentions, hashtags) -> Result<MentionsHashtags, Box<dyn Error>>Parse both or either.
mentions = true to extract @usershashtags = true to extract #tagsparse_mentions(description) -> Result<Vec<String>>Extract all @user names (no duplicates).
parse_hashtags(description) -> Result<Vec<String>>Extract all #tags (no duplicates).
Vec if nothing foundregex and HashSet onlyRun tests:
cargo test
Covers:
MIT