Re: Concatenating/inserting strings with backslashes

2012-11-10 Thread Alan DeKok
Brian Candler wrote: Here's something weird. I'm trying to concatenate some strings which contain backslash n (i.e. not a newline). Well... that's all pretty hacky. It's made worse by Reply-Message being automatically expanded, whereas other attributes aren't. Try your tests below using

Concatenating/inserting strings with backslashes

2012-11-09 Thread Brian Candler
Here's something weird. I'm trying to concatenate some strings which contain backslash n (i.e. not a newline). In a normal string literal, I have to enter four backslashes: update reply { Reply-Message := anb } (\\n gives a newline, \\\n gives backslash followed by newline) But when I

RE: Concatenating/inserting strings with backslashes

2012-11-09 Thread Brian Julin
Brian Candler writes: Or is there another way I can concatenate strings, which doesn't involve expanding them into another string? The workaround I've used for this is to feed the value through a regexp match to get it into %{1}, which does not seem to be subject to unescaping. try: if

Re: Concatenating/inserting strings with backslashes

2012-11-09 Thread Phil Mayers
On 09/11/12 15:39, Brian Candler wrote: Here's something weird. I'm trying to concatenate some strings which contain backslash n (i.e. not a newline). Uh oh... here be dragons! In a normal string literal, I have to enter four backslashes: update reply { Reply-Message := anb }

Re: Concatenating/inserting strings with backslashes

2012-11-09 Thread Brian Candler
try: if (%{reply:Reply-Message} =~ /(.*)/) { update reply { Reply-Message = stuff %{1} } } Nice idea, but it appears to suffer the same expansion problem. As you have written it gives this error: Bare %{...} is invalid in condition at: %{reply:Reply-Message} =~ /(.*)/)

RE: Concatenating/inserting strings with backslashes

2012-11-09 Thread Brian Julin
Brian Candler wrote try: if (%{reply:Reply-Message} =~ /(.*)/) { update reply { Reply-Message = stuff %{1} } } Nice idea, but it appears to suffer the same expansion problem. As you have written it gives this error: Bare %{...} is invalid in condition