[Gretl-users] Quotation marks (" ") and string manipulation

Allin Cottrell cottrell at wfu.edu
Tue May 19 12:55:36 EDT 2015


On Tue, 19 May 2015, Sven Schreiber wrote:

> Am 19.05.2015 um 18:08 schrieb Allin Cottrell:
>> On Tue, 19 May 2015, Sven Schreiber wrote:
>>> 
>>> At first sight from what I quickly tried to do with escaped double
>>> quotes (\") in the regsub() function I would think you're right and
>>> there's a bug there.
>> 
>> There may be something going on with GLib versions here. On Linux with
>> GLib 2.44.0 the following works fine:
>> 
>> <hansl>
>> string s1 = sprintf("string with \"quoted\" bit")
>> print s1
>> string s2 = regsub(s1, "\"", "*")
>> print s2
>> </hansl>
>> 
>
> Yes, but if I do it the other way around:
>
> <hansl>
> string s1 = sprintf("string with *quoted* bit")
> print s1
> string s2 = regsub(s1, "\*", "\"")
> print s2
> </hansl>
>
> then I get an error saying \" is an unknown escape sequence. Or am I missing 
> something?

No, I was missing something: I didn't notice that the question got 
reversed at some point after Henrique Andrade's original posting.

Allin




More information about the Gretl-users mailing list