Only first occurence of a watchword is tagged
This commit is contained in:
parent
20a65e4330
commit
e3823d02f5
@ -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")
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user