bug-bash
[Top][All Lists]
Advanced

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

Re: quote removal issues within character class


From: L A Walsh
Subject: Re: quote removal issues within character class
Date: Sat, 09 Nov 2019 06:46:05 -0800
User-agent: Thunderbird

On 2019/11/09 04:49, Robert Elz wrote:
> There's also
>
>       The special characters '.', '*', '[', and '\\'
>       (<period>, <asterisk>, <left-square-bracket>, and <backslash>,
>       respectively) shall lose their special meaning within a bracket
>       expression.
>   
----
Is this really what the standard says, because '\\' is not a character, but
2 characters.  They could use "\\" but if a backslash is between single
quotes, it loses its special meaning.  The only way to get a backslash
when using single quotes that I've found is to end the single-quote
then use the backslash.  So if you wanted to insert single quotes in
a string that is single-quoted, you would have to do this:

'this is a single-quote(SQ) quoted string using a SQ ('\'') within
the single quote.' 

Alternatively using double-quotes or another quoting
mechanism might be preferable.

I find it odd that the standard would try to use a backslash within
a SQ'd string as a literalizer.





reply via email to

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