reinplace - how to escape \. ?

Ryan Schmidt ryandesign at macports.org
Wed May 27 10:09:10 PDT 2009


On May 27, 2009, at 01:49, Jeremy Lavergne wrote:

> On May 27, 2009, at 2:47 AM, Darren Weber wrote:
>
>> That doesn't work.  I don't understand how this is parsed through  
>> the tcl and port parsers.  How would you do it?
>
> It likely needs a double escape.
>
> Try \\.

Correct. The first backslash escapes from the tcl interpreter. The  
next backslash espaces from the regular expression engine.

reinplace "s|\\.\\./lib/${name}|\\.\\./lib/${distname}|g"} ${destroot} 
${findITKbranch}


If you don't need any variables in your regular expression, you can  
enclose it in {brackets} instead of "quotes" and then you only need a  
single level of escaping. But you are using variables name and  
distname so you need quotes and thus both levels of escaping.




More information about the macports-dev mailing list