Only first occurence of a watchword is tagged

This commit is contained in:
tastytea 2018-01-28 22:07:40 +01:00
parent 20a65e4330
commit e3823d02f5
Signed by: tastytea
GPG Key ID: 59346E0EA35C67E5
2 changed files with 5 additions and 3 deletions

View File

@ -2,7 +2,7 @@ cmake_minimum_required (VERSION 3.7)
include(GNUInstallDirs)
project (rss2mastodon
VERSION 0.1.4
VERSION 0.1.5
LANGUAGES CXX
)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -Wall")

View File

@ -143,8 +143,10 @@ std::vector<string> parse_website(const string &profile, const string &xml)
for (const string &hashtag : watchwords)
{
std::regex rehashtag("\\b(" + hashtag + ")\\b", std::regex_constants::icase);
str = std::regex_replace(str, rehashtag, "#$1");
std::regex rehashtag("\\b(" + hashtag + ")\\b",
std::regex_constants::icase);
str = std::regex_replace(str, rehashtag, "#$1",
std::regex_constants::format_first_only);
}
str += "\n\n" + link + "\n\n#bot";
ret.push_back(str);