From 138c1e915e332fffabedcfd7cdfd96c1f3398bd1 Mon Sep 17 00:00:00 2001 From: silverpill Date: Sat, 11 Mar 2023 17:12:37 +0000 Subject: [PATCH] Allow ! after hashtags and mentions --- CHANGELOG.md | 4 ++++ src/models/posts/hashtags.rs | 2 +- src/models/posts/mentions.rs | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 676c573..29b8f18 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Disabled post tokenization (can be re-enabled with `ethereum-extras` feature). +### Fixed + +- Allow `!` after hashtags and mentions. + ## [1.16.0] - 2023-03-08 ### Added diff --git a/src/models/posts/hashtags.rs b/src/models/posts/hashtags.rs index 4973919..f25da50 100644 --- a/src/models/posts/hashtags.rs +++ b/src/models/posts/hashtags.rs @@ -5,7 +5,7 @@ use crate::errors::ValidationError; use super::links::is_inside_code_block; const HASHTAG_RE: &str = r"(?m)(?P^|\s|>|[\(])#(?P[^\s<]+)"; -const HASHTAG_SECONDARY_RE: &str = r"^(?P[0-9A-Za-z]+)(?P[\.,:?\)]?)$"; +const HASHTAG_SECONDARY_RE: &str = r"^(?P[0-9A-Za-z]+)(?P[\.,:?!\)]?)$"; const HASHTAG_NAME_RE: &str = r"^\w+$"; /// Finds anything that looks like a hashtag diff --git a/src/models/posts/mentions.rs b/src/models/posts/mentions.rs index 544d7bf..1ff683e 100644 --- a/src/models/posts/mentions.rs +++ b/src/models/posts/mentions.rs @@ -13,7 +13,7 @@ use super::links::is_inside_code_block; // See also: ACTOR_ADDRESS_RE in webfinger::types const MENTION_SEARCH_RE: &str = r"(?m)(?P^|\s|>|[\(])@(?P[^\s<]+)"; -const MENTION_SEARCH_SECONDARY_RE: &str = r"^(?P[\w\.-]+)(@(?P[\w\.-]+\w))?(?P[\.,:?\)]?)$"; +const MENTION_SEARCH_SECONDARY_RE: &str = r"^(?P[\w\.-]+)(@(?P[\w\.-]+\w))?(?P[\.,:?!\)]?)$"; /// Finds everything that looks like a mention fn find_mentions(