Boost logo

Boost Users :

Subject: Re: [Boost-users] Can I use Boost.Regex with multilne text to be recognized?
From: Ramon F Herrera (ramon_at_[hidden])
Date: 2009-09-14 20:35:53


OvermindDL1 wrote:
> On Mon, Sep 14, 2009 at 6:12 PM, Ramon F Herrera <ramon_at_[hidden]> wrote:
>> More accurately, my question should be:
>>
>> How hard (or easy) is it to deal with multiple lines of parsed text in
>> Regex?
>>
>> Is there anything special to do? (such as defining an end of line
>> character(s))
>>
>> Perhaps the best advice is to stay away from Regex and use something more
>> powerful (such as Xpressive)?
>
> Regex can handle multi-lines easy, it is all a text blob as far as it
> is concerned. Depending on what you want to use will depend on what
> you are doing, so what are you trying to parse out?

Hi Overmind,

I am trying to parse multiple files with the structure indicated below.
I sort of got started, but I hate it if I am going to hit a wall.

I guess I could start by defining a line like this:

string variable = "([A-Za-z0-9][\\w\\h\\(\\)\\-\\.,/&]*)";
char equal_sign = '=';
string value = "(.+)";
string assignment = variable + equal_sign + value;

string line = assignment + eol;

Any tips and hints are most appreciated and welcome...

-Ramon

---------------------

[Unique ID 1]
Variable Name = Variable Value
Variable Name = Variable Value
Variable Name = Variable Value

[Unique ID 2]
Variable Name = Variable Value
Variable Name = Variable Value
Variable Name = Variable Value

[Unique ID 3]
Variable Name = Variable Value
Variable Name = Variable Value
Variable Name = Variable Value


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