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
2
votes
2 answers

Extract IP address from a string using boost regex?

I was wondering if anyone can help me, I've been looking around for regex examples but I still can't get my head over it. The strings look like this: "User JaneDoe, IP: 12.34.56.78" "User JohnDoe, IP: 34.56.78.90" How would I go about to make an…
Floyd
  • 53
  • 1
  • 2
  • 7
2
votes
2 answers

whats wrong with my c++ regex match

i am writing an robots.txt parser in c++ boost::regex exrp( "^User-agent:\s*(.*)"); boost:: match_results what; if(boost::regex_search( robots, what, exrp ) ) { …
raagavan
  • 951
  • 3
  • 12
  • 16
2
votes
1 answer

While doing url encoding, the std::regex_replace doesn't work properly for character "+"

Following is the code snippet, the regex_replace dosn't work properly for character "+", I should not use special handling for the characters, but it should work properly. /*All headerfiles are available.*/ std::string charToHex(unsigned char c,…
Raj Raulo
  • 51
  • 2
2
votes
1 answer

Boost regex_replace exception: "...This exception is thrown to prevent "eternal" matches..." being thrown on occasion

I am using Boost.Regex(boost-1.42) to remove the first line of a multi-line string(a fairly large string containing multiple lines ending in '\n'). i.e. using regex_replace to do something akin to s/(.*?)\n// string foo::erase_first_line(const…
decimus phostle
  • 1,040
  • 2
  • 13
  • 28
2
votes
1 answer

shared_ptr error while using boost regex

I am working in Codes::blocks 17.12 and installed boost 1.66.0 using GNU. I am using boost and boost regex for first time, so, to start with i copied and pasted code from this site and tried compiling it, but failed. the error which it is showing is…
Sanmveg saini
  • 744
  • 1
  • 7
  • 22
2
votes
2 answers

Invalid Boost Regex Lookbehind with OR and ^

I'm having an issue with boost regex and suspect its a bug, but knew someone here would know for sure and if there's a workaround I'm checking the start of a selection for start of string, white-space or an underscore using (?<=^|\s|_) However…
Chris Barrett
  • 571
  • 4
  • 23
2
votes
3 answers

Non-capturing subroutines

I was wondering if it was possible to call a subroutine but not capture the result of that call. For instance, let's say I want to recursively match and capture a balanced bracket {} structure like {dfsdf{sdfdf{ {dfsdf} }}dfsf} I could use this…
Derek
  • 97
  • 8
2
votes
0 answers

Boost library with node.js addon - segfault

package.json: { "name": "BoostRegexJS", "version": "0.0.1", "description": "Boost::Regex API for node.js", "main": "regex.js", "private": true, "dependencies": { "bindings": "~1.2.1", "nan": "^2.0.0" }, "scripts": { …
ElSajko
  • 1,612
  • 3
  • 17
  • 37
2
votes
0 answers

boost::regex and tilde (~)

Please could you explain why given the following boost::regex pattern: boost::regex re("/\\S+\\w"); /index.html is a match and /~index.html is not? RegexBuddy in Perl mode finds a match in both cases. Could you suggest a pattern that would work?…
Alex Jenter
  • 4,324
  • 4
  • 36
  • 61
2
votes
1 answer

Common symbols '\p{S}' not been 'matched' using boost wregex

I am using the code below to try and match symbols using regex, (as an example, I am trying to match the circle star symbol, http://graphemica.com/%E2%9C%AA) #include //... std::wstring text = L"a✪c"; auto re =…
FFMG
  • 1,208
  • 1
  • 10
  • 24
2
votes
1 answer

std::bad_cast crash seems to be linked to boost_regex

I've gotten the exact same code compiled on Ubuntu and am now trying to get my program working on a MacOS 10.6.4. I installed boost 1.4.4 as root using ./bootstrap.sh and then ./bjam I also performed the following: ./bjam install variant=debug…
David
  • 41
  • 3
2
votes
2 answers

Boost Regex not playing welll with Snow leopard

So I inherited code written in C++ that uses the Boost library. I could compile (using Code Blocks) and run the code on Linux Ubuntu but when I ported it over to the mac and installed the boost library, I can compile it using code blocks (and…
David
  • 41
  • 3
2
votes
1 answer

Regex to match either one of two filename patterns

I am trying to match filenames using boost::regex and I have two kinds of patters: XYZsomestring XYsomestringENDING The string somestring can be anything (>0 characters). The beginning of the filename is either XYZ or XY. If it is XY , there has…
tzippy
  • 6,458
  • 30
  • 82
  • 151
2
votes
1 answer

C++ boost::regex_match strange behaviour

Trying boost::regex_match and got a strange behaviour. boost::cmatch what; std::string fn_re_str = R"(\.sig\|\|([a-zA-Z0-9$]+)\()"; boost::regex fn_re(fn_re_str); if (boost::regex_match("{var d=a[c];if(d.sig||d.s){var e=d.sig||qt(d.", what, fn_re))…
Zelid
  • 6,905
  • 11
  • 52
  • 76
2
votes
1 answer

Problem with boost::find_format_all, boost::regex_finder and custom regex formatter (bug boost 1.42)

I have a code that has been working for almost 4 years (since boost 1.33) and today I went from boost 1.36 to boost 1.42 and now I have a problem. I'm calling a custom formatter on a string to format parts of the string that match a REGEX. For…
Nikko
  • 4,182
  • 1
  • 26
  • 44