On 7/5/07, Thomas Dalton thomas.dalton@gmail.com wrote:
Is that right? In which case, what parses to "|"? The only thing I can think of is "\|". That boils down to:
an odd number of slashes parses to half that number rounded down slashes followed by a divider an even number of slashes parses to half that number slashes followed by a pipe
I guess that might work, but it seems extremely confusing to me.
It's completely standard in programming languages:
print 'hello'
hello
print 'hello''
hello'
print 'hello\'
hello\
print 'hello\''
hello'
print 'hello\\'
hello\
Also in regex. You just have to think about like this: a backslash escapes the character after it, and is itself not displayed. When you escape a delimiter, you get a literal |. When you escape a backslash, you get a literal . So when looking at \|, you read it from left to right, character by character:
1) Backslash. Do not output this, instead escape the next character. 2) Backslash. This is escaped, so output it rather than giving it special meaning. 3) Backslash. Do not output this, instead escape the next character. 4) Vertical bar. This is escaped, so output it rather than giving it special meaning.
Whereas \| gets parsed like:
1) Backslash. Do not output this, instead escape the next character. 2) Backslash. This is escaped, so output it rather than giving it special meaning. 3) Vertical bar. Do not output this, it's a delimiter.