11 Oct
2012
11 Oct
'12
6:29 a.m.
On Wed, Oct 10, 2012 at 06:51:17PM +0100, Phil Mayers wrote:
The other thing is, do we actually need to handle "\" inside // at all, with the exception of escaping the regex delimiter?
I think even then, you would also need to treat backslash backslash as a single backslash. Reason: imagine you wanted to match a a backslash followed by a forward slash. The RE couldn't be \/ because that would be just the escaped forward slash, so it would have to be \\/. Hence every instance of a single backslash needs to be escaped. But backslash followed by any other character could be passed straight through, e.g. \n is "\" and "n". The other question is, do we want escape sequences like \n for newline and \xHH for an arbitrary byte?