Boost logo

Boost-Build :

From: Johan Nilsson (r.johan.nilsson_at_[hidden])
Date: 2006-10-05 03:54:08


Vladimir Prus wrote:
> On Wednesday 04 October 2006 23:14, Johan Nilsson wrote:

[snip]

>> Why not use MATCH on the output to remove whatever you want? Or am I
>> missing something?
>
> FWIW, I had no luck at all getting MATCH to work. I've tried:
>
> local x = [ SHELL "pkg-config --cflags libxml-2.0" ] ;
> echo "X : $(x) : X" ;
>
> local xs = [ MATCH "(.*)\\n" : $(x) ] ;
> echo "Xs : $(xs) : Xs" :
>
> and got:
>
> X : -I/usr/include/libxml2
>> X
> Xs : -I/usr/i : Xs
>
>
> and then I've tried just one slash before 'n' and got the same.

It looks like MATCH doesn't support multi-line mode. In the BJam docs it
states that the MATCH regex should be an egrep pattern, and that doesn't
include \n. If you have a pretty limited output, perhaps you could try the
opposite way around (might contain typos):

---
import regex ;
local pkg-output = [ SHELL "pkg-config --cflags libxml-2.0" ] ;
local items = [ regex.split $(pkg-output) [^A-Za-z0-9_/\\.\\-]+  ] ;
echo $(items:J=", ") ;
# and now extract the correct item(s)
---
HTH // 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