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
19
votes
3 answers

Boost.Regex vs C++11 Regex

Could someone explain the differences between the two? Which would be better to learn right now? How would knowledge transfer from one to the other and vice-versa?
flumpb
  • 1,707
  • 3
  • 16
  • 33
14
votes
1 answer

how to use Boost regular expression replace method?

I have these variables: boost::regex re //regular expression to use std::string stringToChange //replace this string std::string newValue //new value that is going to replace the stringToChange depending on the regex. I only want to replace the…
unwise guy
  • 1,048
  • 8
  • 18
  • 27
12
votes
2 answers

Cannot link Boost regex

I am currently trying to compile a Contraction Hierachies implementation by KIT which requires Boost::Regex. The supplied Makefile already makes sure (and I have also double-checked this manually) that g++ is supplied with the -lboost_regex switch.…
Chris
  • 6,914
  • 5
  • 54
  • 80
10
votes
1 answer

C++ 11 regex: checking if string starts with regex

I am using C++ 11's support, and would like to check whether the beginning of a string matches a regular expression. [I can switch to Boost if that helps, but my impression is that they're basically the same.] Obviously if I have control of…
EvanED
  • 947
  • 6
  • 22
9
votes
2 answers

Ignore case using boost::regex_search

How do you use boost::regex_search with the ignore case flags or constants in C++? Please post an easy example. Thanks!
arturgspb
  • 1,004
  • 1
  • 12
  • 19
9
votes
2 answers

how to convert bash script to C++ using boost::iostreams

I'm trying to convert the following bash code into C++ using boost::iostreams: #!/usr/bin/bash ( gzip -cd file1.ext.gz cat file2.ext ) | grep '^regex' # or sed 's/search/replace/' I can open a file and decompress it: std::ifstream…
chris
  • 3,986
  • 1
  • 26
  • 32
9
votes
1 answer

Undefined reference when Gcc compiling Boost::regex with multiple versions of boost exist

I was trying to install Boost on a linux machine(CentOs, Linux version 2.6.9-67.ELsmp). I followed with the instruction on Boost Getting Started webpage. Downloaded and extracted the files, then I add prefix because I am not the root…
user1350816
  • 93
  • 1
  • 1
  • 3
8
votes
3 answers

C++ Regular Expressions with Boost Regex

I am trying to take a string in C++ and find all IP addresses contained inside, and put them into a new vector string. I've read a lot of documentation on regex, but I just can't seem to understand how to do this simple function. I believe I can…
alyx
  • 2,593
  • 6
  • 39
  • 64
8
votes
1 answer

Why doesn't boost regex '.{2}' match '??'

I'm trying to match some chunks if interesting data within a data stream. There should be a leading < then four alphanumeric characters, two characters of checksum (or ?? if no shecksum was specified) and a trailing >. If the last two characters…
Jon Cage
  • 36,366
  • 38
  • 137
  • 215
7
votes
2 answers

linking to boost regex in gcc

i am trying to compile my program which uses regex on linux. I built the boost library in the libs/regex/build by typing make -fgcc.mak which created a directory gcc which contains the following four…
user59988
7
votes
2 answers

C++/Boost: Writing a more powerful sscanf replacement

I want to write a function in C++ to replace C's sscanf that assigns the matches to iterator. Basically, I want something like: string s = "0.5 6 hello"; std::vector any_vector; sscanv(s, "%f %i %s", any_vector); cout << "float: " <<…
deuberger
  • 3,578
  • 6
  • 31
  • 33
7
votes
1 answer

Problems with the two parameter format function in boost::regex_replace

I am having problems with the format function in boost::regex_replace. I can call the one parameter version of it, but not the two parameter: e = "(^|>)([^<>]+)"; h_str = regex_replace(h_str, e, repl_quot, boost::match_default); Where repl_quot is…
Mark
  • 1,214
  • 10
  • 24
7
votes
2 answers

Why did boost regex run out of stack space?

#include #include #include using namespace boost; static const regex regexp( "std::vector<" "(std::map<" "(std::pair<((\\w+)(::)?)+, (\\w+)>,?)+" ">,?)+" …
7
votes
4 answers

fatal error LNK1104: cannot open file 'libboost_regex-vc90-mt-gd-1_42.lib'

i'm trying to use boost regex within my program the problem is i get this error... the only installation step i did was to add: "C:\Program Files\boost\boost_1_42" into the Additional Include Directories... i'm using VS2008... trying to implement…
kaycee
  • 211
  • 2
  • 3
  • 6
6
votes
4 answers

How do I capture all matches of a repeating group with Boost::regex_search?

I am trying to parse an input string using a regular expression. I am getting a problem when trying to capture a repeating group. I always seem to be matching last instance of the group. I have tried using Reluctant (non greedy) quantifiers, but I…
omshanti
  • 71
  • 1
  • 4
1
2 3
19 20