Boost logo

Boost :

From: Sam Holden (sholden_at_[hidden])
Date: 2001-05-15 19:55:10


moshebox_at_[hidden] writes:
>Hi
>
>I have a question regarding Regex , I got it to collect phrases from
>a file for me.
>
>the problem is some of the phrases include a newline character. I
>would like to get the same phrases minus the newline characters , is
>there anyway to tell Regex to return the phrase while proceeding when
>encountering a newline but ignoring it when returning a match ?

If you don't pass match_not_dot_newline to the matching algorithms then dot
will match a newline (according to the docs - I've never tried).

Then you can replace the newlines in the match with spaces and you should have
what you want. Or remove them completely if that is what is wanted. There are
a whole slew of STL algorithms and std::string methods that make that easy...

If you need some dots to match newlines and others not, then I gess you just
use [^\n] instead of dot in the places you don't want newlines.

-- 
Sam
People get annoyed when you try to debug them.
	--Larry Wall

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk