Reputation: 119
I am confused with the following statements .
% set a \\\\\w
\\w
% set a \\\\w
\\w
% set a \\w
\w
In the First statement I am having 5 (backslashes) and it produced 2 (backslashes) as output.
In the second statement I am having 4 (backslashes) and it produced 2 (backslashes) as output.
In the Third statement I am having 2 (backslashes) and it produced 1 (backslashes) as output.
Up to my knowledge \\
is equal to \
after substitution .
As it is \\\\\
it should return single \
na.
Can Anyone Please Explain me how the substitution occures.
Upvotes: 0
Views: 55
Reputation: 15173
Well, it is simple:
\\
will be substituted into \
, so \\\\
will be replaced with \\
(not a single \
). For a list of all special substitutions, see the manual.\w
) the backslash will be removed. From the manual:
In all cases but those described below the backslash is dropped and the following character is treated as an ordinary character and included in the word.
Upvotes: 2