fixed regex (\b matches non-ascii letters)

This commit is contained in:
tastytea 2018-01-29 01:41:23 +01:00
parent e3823d02f5
commit 219c6ec1d0
Signed by: tastytea
GPG Key ID: 59346E0EA35C67E5
2 changed files with 2 additions and 2 deletions

View File

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

View File

@ -143,7 +143,7 @@ std::vector<string> parse_website(const string &profile, const string &xml)
for (const string &hashtag : watchwords)
{
std::regex rehashtag("\\b(" + hashtag + ")\\b",
std::regex rehashtag("[[:space:][:punct:]](" + hashtag + ")[[:space:][:punct:]]",
std::regex_constants::icase);
str = std::regex_replace(str, rehashtag, "#$1",
std::regex_constants::format_first_only);