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
0 answers

Segmentation fault caused by boost::regex with -DBOOST_DISABLE_THREADS and -finline-functions switches

I am trying to execute following code which extracts the email address from the string. I am getting segmentation fault. // A.cpp #include #include #include int main() { std::string…
Sagar Kapare
  • 196
  • 4
1
vote
1 answer

Boost regex not replacing expression that replaces correctly on regex websites

I was trying to do a regex replace with boost::regex, but it doesn't seem to be working. Here is the regex expression: (\\w+,\\d+,\\d+,\\d+\tscript\t)(.+)(#)(.+)(\t\\d+(,\\d+)?(,\\d+)?,{) And the formatter: $1\"$2\"$3\"$4\"$5 The code: (getInput()…
RenatoUtsch
  • 1,449
  • 1
  • 13
  • 20
1
vote
1 answer

How to match alphanumeric pattern in Regex?

Hi I am new to the regex I am trying to match the pattern for bellow line T071108452T 42D896D5O 3587 I want to match the pattern till T071108452T 42D896D5 and after this i want the Character "O" to match i tried something like this …
user2553512
1
vote
2 answers

escape sequence \K for regular expression in boost library

I need to replace a look-behind expression with \K in boost (version 1.54) because of its limitation but it does not work. How can I do it or what is the problem? Is there any other way to convert this expression with lookahead? "(?<=foo.*) bar" …
MaySam
  • 11
  • 2
1
vote
1 answer

C++, Boost regex, replace value function of matched value?

Specifically, I have an array of strings called val, and want to replace all instances of "%{n}%" in the input with val[n]. More generally, I want the replace value to be a function of the match value. This is in C++, so I went with Boost, but if…
rofrankel
  • 2,486
  • 2
  • 19
  • 19
1
vote
2 answers

Using Boost C++ library to do a regex replace with a custom replacement

I can use Xpressive of the Boost library to do some regex replacement like this: #include #include void replace(){ std::string in("a(bc) de(fg)"); sregex re = +_w >> '(' >> (s1= +_w) >> ')'; …
muffel
  • 7,004
  • 8
  • 57
  • 98
1
vote
1 answer

Join two regular expression results into one output field, when only one is possible at a time

I'm parsing chat output to get the user name. This is what outputs may look like: MC_BOT sethome (From Darker): MC_BOT exit I need to match username and the command contents in the string. Taking these data from both strings is…
Tomáš Zato
  • 50,171
  • 52
  • 268
  • 778
1
vote
2 answers

error while working with boost::sregex_token_iterator

I want to search for a regular expression and print it with a color. I used boost::sregex_token_iterator to do this. this is my code boost::regex re("ab."); string s=""; string buf; string infile("retest.txt"); //string…
vahidzolf
  • 109
  • 1
  • 1
  • 13
1
vote
2 answers

getting between square bracket having specific characteristic using Boost regex in C++ not getting answer

I have a string like this: This is a link [[abcd 1234|xyz 1234]] [[India]] [[abcd 1234|xyz 1234]] and I want to get : This is a link abcd 1234 [[India]] abcd 1234 I want to take double square brackets having | and take out things that are before…
psyche
  • 443
  • 1
  • 5
  • 14
1
vote
1 answer

Boost Regex unknown number of var

I have an issue with a regex expression and need some help. I have some expressions like these in mein .txt File: 19 = NAND (1, 19) regex expression : http://rubular.com/r/U8rO09bvTO With this regex expression I got seperated matches for the…
1
vote
1 answer

boost regex_search cannot find the first match

boost::regex re("(abc)(.*?)"); boost::smatch m; std::string str = "abcdlogin"; boost::regex_search(str, m, re); I found m[1].first is "abcdlogin", m[1].second is "dlogin". But I think is m[1].first should be "abc"?
Mark Ma
  • 1,342
  • 3
  • 19
  • 35
1
vote
2 answers

How to check which matching group was used to match (boost-regex)

I'm using boost::regex to parse some formatting string where '%' symbol is escape character. Because I do not have much experience with boost::regex, and with regex at all to be honest I do some trial and error. This code is some kind of prototype…
Dino
  • 599
  • 1
  • 9
  • 20
1
vote
1 answer

CMake Debian Dependency on Boost Regex

I am currently trying to build a debian package from my project, which uses Boost-Regex. Everything is working fine except defining a dependency throug CPACK_DEBIAN_PACKAGE_DEPENDS. I don't seem to be able to figure out the right module name to…
padde
  • 661
  • 8
  • 19
1
vote
0 answers

Boost Regex not working in Visual Studio 2010

I don't understand why Boost Regex doesn't work with my current VS 2010 project. On Linux the same code works fine and even in VS 2010 if I create a small project with just the offending code and same inputs it works. In my project when…
Gabi
  • 13
  • 2
1
vote
1 answer

Static link of boost_regex library

I wrote a program using boost_regex library(ver 1.33.1) in CentOS 5.2 environment. I installed the Boost library with yum command. My program accepts compiling with this set of options below: g++ -O2 -g -lm -lboost_regex main.cpp However, this set…