Good Catch. I now see that the
's second set of examples includes one with a double backslash before the '$'. Unfortunately, he does not give us the results that he expects. The algorithm which he describes in words would treat that '$' as escaped. I cannot tell whether you have found an error common to both solutions, or if I accidentally did 'what he intended'.