@ -135,13 +135,13 @@ static RE_PING: once_cell::sync::Lazy<Regex> = Lazy::new(|| command!(r"ping"));
static RE_ANNOUNCE : once_cell ::sync ::Lazy < Regex > =
static RE_ANNOUNCE : once_cell ::sync ::Lazy < Regex > =
Lazy ::new ( | | Regex ::new ( r"(?:^|\s|>|\n)[\\/]announce\s+(.*)$" ) . unwrap ( ) ) ;
Lazy ::new ( | | Regex ::new ( r"(?:^|\s|>|\n)[\\/]announce\s+(.*)$" ) . unwrap ( ) ) ;
static RE_A_HASHTAG : once_cell ::sync ::Lazy < Regex > = Lazy ::new ( | | Regex ::new ( r"(?:^|\b|\ s|>|\n)#(\w+)" ) . unwrap ( ) ) ;
static RE_A_HASHTAG : once_cell ::sync ::Lazy < Regex > = Lazy ::new ( | | Regex ::new ( r"(?:^|\s|>|\n)#(\w+)" ) . unwrap ( ) ) ;
pub static RE_NOBOT_TAG : once_cell ::sync ::Lazy < Regex > =
pub static RE_NOBOT_TAG : once_cell ::sync ::Lazy < Regex > =
Lazy ::new ( | | Regex ::new ( r"(?:^|\b|\ s|>|\n)#nobot(?:\b|$)" ) . unwrap ( ) ) ;
Lazy ::new ( | | Regex ::new ( r"(?:^|\s|>|\n)#nobot(?:\b|$)" ) . unwrap ( ) ) ;
pub static RE_HASHTAG_TRIGGERING_PLEROMA_BUG : once_cell ::sync ::Lazy < Regex > =
pub static RE_HASHTAG_TRIGGERING_PLEROMA_BUG : once_cell ::sync ::Lazy < Regex > =
Lazy ::new ( | | Regex ::new ( r"(?:^|\b|\ s|>|\n)#\w+[^\s]*$" ) . unwrap ( ) ) ;
Lazy ::new ( | | Regex ::new ( r"(?:^|\s|>|\n)#\w+[^\s]*$" ) . unwrap ( ) ) ;
pub fn parse_status_tags ( content : & str ) -> Vec < String > {
pub fn parse_status_tags ( content : & str ) -> Vec < String > {
debug ! ( "Raw content: {}" , content ) ;
debug ! ( "Raw content: {}" , content ) ;
@ -563,6 +563,8 @@ mod test {
assert! ( RE_A_HASHTAG . is_match ( "#городДляЛюдей" ) ) ;
assert! ( RE_A_HASHTAG . is_match ( "#городДляЛюдей" ) ) ;
assert! ( RE_A_HASHTAG . is_match ( "foo #banana gfdfgd" ) ) ;
assert! ( RE_A_HASHTAG . is_match ( "foo #banana gfdfgd" ) ) ;
assert! ( RE_A_HASHTAG . is_match ( "foo #городДляЛюдей aaa" ) ) ;
assert! ( RE_A_HASHTAG . is_match ( "foo #городДляЛюдей aaa" ) ) ;
assert! ( ! RE_A_HASHTAG . is_match ( "foo https://google.com/#banana gfdfgd" ) ) ;
assert! ( ! RE_A_HASHTAG . is_match ( "foo https://google.com/?foo#banana gfdfgd" ) ) ;
for ( i , c ) in RE_A_HASHTAG . captures_iter ( "foo #banana #χαλβάς #ласточка" ) . enumerate ( ) {
for ( i , c ) in RE_A_HASHTAG . captures_iter ( "foo #banana #χαλβάς #ласточка" ) . enumerate ( ) {
if i = = 0 {
if i = = 0 {
@ -590,7 +592,7 @@ mod test {
assert! ( ! RE_NOBOT_TAG . is_match ( "banana #tag sdfsd" ) ) ;
assert! ( ! RE_NOBOT_TAG . is_match ( "banana #tag sdfsd" ) ) ;
assert! ( ! RE_NOBOT_TAG . is_match ( "banana #nobotanicals sdfsd" ) ) ;
assert! ( ! RE_NOBOT_TAG . is_match ( "banana #nobotanicals sdfsd" ) ) ;
assert! ( RE_NOBOT_TAG . is_match ( "#nobot" ) ) ;
assert! ( RE_NOBOT_TAG . is_match ( "#nobot" ) ) ;
assert! ( RE_NOBOT_TAG . is_match ( "aaa#nobot" ) ) ;
assert! ( RE_NOBOT_TAG . is_match ( "aaa\n #nobot" ) ) ;
assert! ( RE_NOBOT_TAG . is_match ( "aaa #nobot" ) ) ;
assert! ( RE_NOBOT_TAG . is_match ( "aaa #nobot" ) ) ;
assert! ( RE_NOBOT_TAG . is_match ( "#nobot xxx" ) ) ;
assert! ( RE_NOBOT_TAG . is_match ( "#nobot xxx" ) ) ;
assert! ( RE_NOBOT_TAG . is_match ( "#nobot\nxxx" ) ) ;
assert! ( RE_NOBOT_TAG . is_match ( "#nobot\nxxx" ) ) ;