evaluate.c & strings with "\" in them

Brian Candler B.Candler at pobox.com
Thu Oct 11 12:29:42 CEST 2012


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?


More information about the Freeradius-Devel mailing list