Re: string manipulation : removing a part of a string

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

 





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

_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
https://lists.gnu.org/mailman/listinfo/autoconf


[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux