autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: string manipulation : removing a part of a string


From: Vincent Torri
Subject: Re: string manipulation : removing a part of a string
Date: Mon, 18 Jun 2012 18:01:28 +0200 (CEST)



On Mon, 18 Jun 2012, Eric Blake wrote:

On 06/18/2012 09:40 AM, Vincent Torri wrote:

But you can still be shorter than using a pushdef:

option=m4_bpatsubst([[$2]], [^-Wno-], [-W])

does not work. Removing ^ seems to work

Oh, right.  That's due to the necessity of double-quoting $2 introducing
extra characters to be matched by the regex.  Omitting the anchor means
that you will match -Wno- wherever it appears (even in
-fsome-Wno-option); and if you are worried about that being a real
possibility, then you can restore the anchoring effect by taking into
account the double-qouting, and all without unbalancing [], by the use
of the . regex:

option=m4_bpatsubst([[$2]], [^\(.\)-Wno-], [\1-W])

But you are probably right that you don't have to worry about -Wno-
appearing anywhere but the beginning, in which case omitting the anchor
is indeed simplest.

yes. having -Wno- not at the beginning is not a problem :)

thank you for your help

Vincent Torri



reply via email to

[Prev in Thread] Current Thread [Next in Thread]