[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Escaping a ',' in autoconf
From: |
Ralf Wildenhues |
Subject: |
Re: Escaping a ',' in autoconf |
Date: |
Wed, 26 Oct 2005 09:00:02 +0200 |
User-agent: |
Mutt/1.5.11 |
* Ralf Wildenhues wrote on Wed, Oct 26, 2005 at 08:53:26AM CEST:
> * Kristis Makris wrote on Wed, Oct 26, 2005 at 03:07:47AM CEST:
> >
> > I'm having a hard time escaping a comma (',') in autoconf. I'm trying to
> > set to a variable the regular expression: [,\s#]. I can set almost
> > everything, except the comma:
> >
> > DEVEL_CONFIG_TEMPLATE_BUGID_SPLIT_REGEX="@<:@address@hidden:@@:>@"
> >
> > Can anyone recommend how this is done ?
>
> Outside of any macro definitions or calls (the former is really a
> special case of the latter), a comma should not hurt at all.
> Inside, you should ensure to have quoted enough. The general rule is:
> One level of quotation per level of nesting.
And I forgot the other half of the mail, sorry:
Literals are to be quoted twice. So then you end up writing the literal
[,\s#]
as
[[,\s#]]
or, in other words:
DEVEL_CONFIG_TEMPLATE_BUGID_SPLIT_REGEX="[[,\s#]]"
Some people prefer to put the outer pair of brackets (which are really
just the second m4 quotation further outside, at least for more
complicated expressions:
[compicated_regex='[^a-z]*[a-z]']
instead of
compicated_regex='[[^a-z]]*[[a-z]]'
but since m4 really doesn't care much about shell syntax, it does not
matter so much, but is up to personal preference.
Cheers,
Ralf