Skip to content

Commit 7a33ad8

Browse files
committed
Fixed bug in split_regex()
1 parent 3a6afef commit 7a33ad8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/utilities.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ template<typename T> inline void println(const T& x) {
562562
inline vector<string> split_regex(const string& s, const string& separator="\\s+") {
563563
vector<string> r;
564564
const std::regex rgx(separator);
565-
std::sregex_token_iterator token(s.begin(), s.end()+1, rgx, -1), end;
565+
std::sregex_token_iterator token(s.begin(), s.end(), rgx, -1), end;
566566
while(token!=end) {
567567
r.push_back(*token);
568568
token++;
@@ -591,7 +591,7 @@ inline void print_message(const string& message, const string& keyword="", const
591591
const uint k=length(keyword)+2u, w=CONSOLE_WIDTH-4u-k;
592592
string p=colons?": ":" ", f="";
593593
for(uint j=0u; j<k; j++) f += " ";
594-
vector<string> v = split_regex(message, "[\\s\\0]+");
594+
vector<string> v = split_regex(message);
595595
uint l = 0u; // length of current line of words
596596
for(uint i=0u; i<(uint)v.size(); i++) {
597597
const string word = v.at(i);

0 commit comments

Comments
 (0)