|
Boost Users : |
Subject: [Boost-users] Search and replace in text files with Boost.Xpressive
From: Júlio Hoffimann (julio.hoffimann_at_[hidden])
Date: 2011-04-01 21:23:03
What is the better approach with Boost to catch a file with some
wildcard-prefixed variables and replace them by numerical values?
Example:
$ cat file.tmpl
============
var1 = $something
...
...
$coord1 $coord2 ... $coordN
...
...
============
$ cat file.dat
============
var1 = 2.35323
...
...
1.4 3.5 124 910
...
...
============
The Boost libraries i know for regular expressions are Boost.Regex and
Boost.Xpressive. I like the second, because it's header only, has static and
dynamic regular expressions and uses it's own namespace. In other words, it
incorporates the features of Boost.Regex in a more elegant way.
As far as i know, Boost.Xpressive treats only std::string and C-like
strings. What i need to do for work with text files? Put them inside a
std::string? About the performance, the files has approximately 10^3 lines,
the search and replace will be an issue?
Regards,
Júlio.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net