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
3
votes
1 answer

Ignore case with boost::regexp

Strangely enough, google refuses to answer such simple question: How do I make boost::regexp case-insensitive? This is what I have: static const boost::regex bad_words("(?:^|.* )(f(?:uc|a)k(?:i[ng]{1,2})?|bitch(?:es|iz)?)(?:$| .*)"); //reduced to…
Tomáš Zato
  • 50,171
  • 52
  • 268
  • 778
3
votes
2 answers

Using boost::regex_search() with string iterators

I'm trying to get boost::regex to give me all occurrences of a pattern in a search string. Thought such things would be simple, but leave it to boost and STL to add 10 meta-layers of template obfuscation on top of everything :). My latest attempt is…
QuadrupleA
  • 876
  • 6
  • 23
3
votes
2 answers

Put first boost::regex match into a string

Somehow, I've failed to find out, how to put only the first occurrence or regular expression to string. I can create a regex object: static const boost::regex e("<(From )?([A-Za-z0-9_]+)>(.*?)"); Now, I need to match ([A-Za-z0-9_]+) to…
Tomáš Zato
  • 50,171
  • 52
  • 268
  • 778
3
votes
2 answers

Is there any way to extract Boost Regex so I can package it with my project?

I'm working on a project written in C++ that uses the Boost Regex library to do some parsing. My problem is, I need to run the program on a remote machine that doesn't have the boost library installed. I also don't have admin access to this…
martega
  • 2,103
  • 2
  • 21
  • 33
3
votes
2 answers

Expression: string iterator not dereferencable while using boost regex

I want to recover all the links from a page, while executing this code I get: Microsoft Visual C++ Debug Library Debug Assertion Failed! Program: C:\Users\Gandalf\Desktop\proxy\Debug\Proxy.exe File: C:\Program Files\Microsoft Visual Studio…
Claudiu Claw
  • 893
  • 7
  • 10
3
votes
1 answer

Setting Boost regex locale?

In boost 1.48.0 I find this in the regex code (boost/regex/v4/w32_regex_traits.hpp): w32_regex_traits() : m_pimpl(re_detail::create_w32_regex_traits(::boost::re_detail::w32_get_default_locale())) { } //...// BOOST_REGEX_DECL…
l33t
  • 18,692
  • 16
  • 103
  • 180
2
votes
1 answer

boost regex formatter, how to use a custom function

Well how do I invoke a custom formatting function when calling boost::regex_replace? My code is as following: template std::string fmt(boost::match_results match) { auto str = match[1]; if (str == ".") { return…
paul23
  • 8,799
  • 12
  • 66
  • 149
2
votes
1 answer

Parsing a zero-width regex with a regex

We use zero-width regex strings to specify the places in a string of amino acid symbols (basically A-Z) that are valid cleavage sites. For example, the proteolytic enzyme trypsin cleaves after K or R except when followed by P ((?<=[KR])(?!P)). I…
Matt Chambers
  • 2,229
  • 1
  • 25
  • 43
2
votes
1 answer

How to use u8_to_u32_iterator in Boost Spirit X3?

I am using Boost Spirit X3 to create a programming language, but when I try to support Unicode, I get an error! Here is an example of a simplified version of that program. #define BOOST_SPIRIT_X3_UNICODE #include…
2
votes
1 answer

Compile Boost.Regex 1.76 in NON C++03 mode with MSVC _MANAGED (C++/CLI)?

TL;DR Is it possible to compile Boost.Regex 1.76 in Header Only Mode (non BOOST_REGEX_CXX03 mode) with a C++/CLI i.e. /clr i.e. _MANAGED project? We have been using Boost.Regex for years in our regular Visual C++ projects. A very few of our…
Martin Ba
  • 37,187
  • 33
  • 183
  • 337
2
votes
2 answers

how to understand what part of the boost::regex failed to match/search

I am using boost::regex to match (better to say boost::regex_search) a text vs a regular expression. This one doesn't match and my regex is really huge. Do you know if in the library is there any function telling me which part of the regex failed…
Abruzzo Forte e Gentile
  • 14,423
  • 28
  • 99
  • 173
2
votes
1 answer

boost::regex_constants::error_type to string

I have a function checks if an expression matches a regex, and returns a boost::regex_constants::error_type, it logs the error in case of exception: boost::regex_constants::error_type RegexMatch(const std::string& p_expression, const std::string&…
gluttony
  • 402
  • 6
  • 14
2
votes
3 answers

C++ assertion crash when using boost regex lib

I just installed the boost lib and visual studio on my new laptop. I'm getting the following error while trying to run my code: Assertion failed: r != 0, file libs\regex\build\..\src\w32_regex_traits.cpp, line 125 The error occurs when running in…
cdo-dev
  • 21
  • 1
2
votes
1 answer

Using Boost-Regex to parse string into characters and numerals

I'd like to use Boost's Regex library to separate a string containing labels and numbers into tokens. For example 'abc1def002g30' would be separated into {'abc','1','def','002','g','30'}. I modified the example given in Boost documentation to come…
John
  • 4,304
  • 1
  • 16
  • 10
2
votes
0 answers

A specific Boost regex works fine, but if I use it inside a Boost unit test it crashes

Everything worked fine with my project when using Boost 1.58 and GCC4.9, after deciding to upgrade it to Boost 1.72 and GCC9 I have started to have this problem. I've been looking into this for a while and at first I thought it was a problem with…
David Moreno
  • 141
  • 9