|
Boost-Build : |
From: Johan Nilsson (r.johan.nilsson_at_[hidden])
Date: 2006-10-06 03:10:41
Rene Rivera wrote:
> Johan Nilsson wrote:
[split]
>>
>> I've already tried a variant of the "physical newline declaration"
>> trick under Windows, but couldn't get it to work properly. Perhaps
>> it is possible to make it work, but I gave up after a couple of
>> attempts.
>
> Seems to work for me...
>
> ====
> C:\Documents and Settings\grafik>bjam -f -
> nl = "
> " ;
> o = "one two three
> " ;
> xs = [ MATCH "([^
> ]*)" : $(o) ] ;
> ECHO *$(xs)* ;
> ^Z
> *one two three*
Yes, that works for me as well.
I was actually trying to split an arbitrary number of eol separated items.
Can't get it to work, except by resorting to the something like "regex.split
<to-split> [^A-Za-z ... etc ...] to separate the lines. The following works
as expected (but leaves an empty element as the last in $(o), which is easy
to fix):
---- import regex ; o = "one\\path a:\\nother\\path three.files -I/include/path/unix " ; xs = [ regex.split $(o) [^A-Za-z0-9:/\\.-]+ ] ; EXIT split: *$(xs)* ; split: *one\path* *a:\nother\path* *three.files* *-I/include/path/unix* ** ---- Is it really possible to split, e.g.: o = "one two three" ; so that $(xs) equals one two three , using the nl definition above in a regex? This is what I've tried, but it seems to get stuck in an endless loop: ---- import regex ; nl = " " ; o = "one two three " ; xs = [ regex.split $(o) $(nl) ] ; EXIT split: *$(xs)* ; ---- // Johan
Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk