$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: John Maddock (john_at_[hidden])
Date: 2008-03-31 04:54:04
Danny Gilbert wrote:
> Hi ! I work with Visual Studio 2003, C++. I am reading data from a
> UNICODE 
> file
> in a std::wstring. (It works fine) I want to find with
> boost::regex_search a 
> pattern like the following:
> 
> @@FOREACH(item in list) data  @@END
> 
> I want 3 substrings (submatch) like the following:  1-  item     2-
> list 3- data
> We can have line feed, carriage return, space, etc. between ( and
> item, 
> between ) and the data, and between data and @@END.
> 
> So the following must work:
> @@FOREACH(  item     in      list     )
>    data
>       @@END
> 
> 
> I DID MANY THINGS (TRY AND ERROR) AND I CAN FIND the first submatch
> item and 
> the second submatch list. The third submatch never works. It don't
> see the @@END command (instruction) and get all the remaining stuff
> of the string. I 
> used Regex Coach software and Rad Regex Designer but with theses
> softwares, 
> my REGEX expression works.
> 
> What is the correct REGEX expression with BOOST ????
Well the same as for any other regex package!
Off the top of my head, how about something like:
"@@FOREACH\\(\\s*(\\S+)\\s+in\\s+([^)]*?)\\s*\\)\\s*(.*?)\\s*@@END"
HTH, John.