« Return to Thread: Need help with REGEX expression ( boost::regex_search )

Need help with REGEX expression ( boost::regex_search )

by Danny Gilbert :: Rate this Message:

Reply to Author | View in Thread

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 ????

Thank you !

 « Return to Thread: Need help with REGEX expression ( boost::regex_search )