Questions tagged [boost-regex]

Boost.Regex is a C++ regular expression library with optional Unicode support through ICU.

Boost.Regex is a C++ regular expression library with optional Unicode support through ICU.

296 questions
1
vote
1 answer

My last regular expression won't work but i cannot figure out the reason why

I have two vectors, one which holds my regular expressions and one which holds the string in which will be checked against the regular expression, most of them work fine except for this one (shown below) the string is a correct string and matches…
CodersSC
  • 710
  • 2
  • 13
  • 29
1
vote
2 answers

set boost regex from foreign source

I need to parse log and I`ve good working regex, but now I need to set regex from config file and here is problem. int logParser() { std::string bd_regex; // this reads from config in other part of program boost::regex parsReg; …
Nobody
  • 11
  • 3
1
vote
2 answers

Trying to duplicate lines and parse list in NPP

Given a list of profile image links in markdown with varying name lengths: ![[Last, First.jpg]] ![[Longerlast, Longerfirst.jpg]] etc How can I convert to the following using regex in NPP? ![[Last, First.jpg]] ::Last, First ![[Longerlast,…
1
vote
1 answer

boost::algorithim::split_regex

For the function boost::split_regex(std::vector, std::string, std::string); I end up with Empty tokens and I would like to compress them, but unlike boost::split, I cannot find a token_compress_on option for regex_split. As it is still…
Warren Niles
  • 184
  • 9
1
vote
1 answer

Thread safety of boost::regex_match

ThreadSanitizer gives me an alleged race condition in boost::regex_match. Is this a false positive? I cannot find synchronization primitives that depend on BOOST_HAS_THREADS in the callstacks. All input parameters are on the stack of the respective…
Desperado17
  • 835
  • 6
  • 12
1
vote
2 answers

Constructing boost regex

I want to match every single number in the following string: -0.237522264173E+01 0.110011117918E+01 0.563118085683E-01 0.540571836345E-01 -0.237680494785E+01 0.109394729137E+01 -0.237680494785E+01 0.109394729137E+01 0.392277532367E+02 …
user312650
1
vote
0 answers

Boost DYN_LNK vs. USE_DLL vs. USE_LIB

What is the difference between the following defines: #define BOOST_REGEX_DYN_LNK #define BOOST_REGEX_USE_DLL #define BOOST_REGEX_USE_LIB (regex was chosen arbitrarily)? Which of them auto-link the project with libboost*.lib, boost*.lib, boost*.dll…
Marc Andreson
  • 3,405
  • 5
  • 35
  • 51
1
vote
1 answer

How to store intermediate values of circular buffer iterator?

I am a using a boost regex on a boost circular buffer and would like to "remember" positions where matches occur, what's the best way to do this? I tried the code below, but "end" seems to store the same values all the time! When I try to traverse…
Abryan
  • 27
  • 8
1
vote
1 answer

Boost regexp how to translate such PHP unescape function to C++?

Whe I had to create CMS in PHP I created simple unescape html function that looked like this: function unescape($s) { $s= preg_replace('/%u(....)/', '&#x$1;', $s); $s= preg_replace('/%(..)/', '&#x$1;', $s); return $s; } How to translate it…
Rella
  • 65,003
  • 109
  • 363
  • 636
1
vote
1 answer

What would be Boost::regexp analog for PHP`preg_match_all`function?

So I have such php function I want to translate to C++: protected function htmlTag($content, $tag, $attrName, $attrValue, $valueName) { preg_match_all("#<{$tag}[^>]*$attrName=['\"].*?$attrValue.*?['\"][^>]*$valueName=['\"](.+?)['\"][^>]*/?>#i",…
Rella
  • 65,003
  • 109
  • 363
  • 636
1
vote
1 answer

boost regex iterator returning empty string

I am a beginner to regex in c++ I was wondering why this code: #include #include #include int main() { std::string s = "? 8==2 : true ! false"; boost::regex…
Ashtyn
  • 29
  • 4
1
vote
2 answers

boost xpressive: wrong match?

I want to match a simple expression with boost, but it behaves strange... The code below should match and display "a" from first and second strings: #include #include #include "stdio.h" using namespace…
Jakub M.
  • 32,471
  • 48
  • 110
  • 179
1
vote
1 answer

Invalid read size 1 in valgrind using boost::smatch

I am using boost::smatch object to get the matching pattern from boost::regex_match and use that matching pattern string for further operations. It's working fine in a normal run, but when I use Valgrind for memory checking it is showing an error in…
1
vote
2 answers

When should I prefer boost::regex ( or boost::xpressive) over boost::algorithm

I thought the boost regex engines would be faster than boost::algorithm This simple test shows algo beating the regex engines by a wide margin This is the entire test program Did I miss something? #include "boost/algorithm/string.hpp" #include…
user754425
  • 437
  • 1
  • 4
  • 10
1
vote
1 answer

Help with boost::regex trim

This regex will trim the string at line breaks. I want it to trim both end only and preserve any line breaks in the middle. string s(" Stack \n Overflow "); boost::regex expr("^[ \t]+|[ \t]+$"); std::string fmt(""); cout <<…
user754425
  • 437
  • 1
  • 4
  • 10