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

Hélio Guilherme helioxentric at gmail.com
Mon May 18 18:18:53 EDT 2015


Hi Henrique,

I think you found a bug. The following code works fine:
string Texto2 = regsub(Texto, "[']", "\\")
print Texto2

But only works for the "\\", of you try with other escaped chars it fail.

As an example of Perl regex, the following Unix command gives the expected
result.

sed "s/[']/\"/g" "Morte e Vida SeverinaSeverino.txt"

Hélio

On Mon, May 18, 2015 at 8:43 PM, Henrique Andrade <henrique.coelho at gmail.com
> wrote:

> Em 18 de maio de 2015, Sven escreveu:
>
> Am 18.05.2015 um 21:17 schrieb Henrique Andrade:
>>
>>> Dear Gretl Community,
>>>
>>> How can I use quotation marks inside a Gretl function that deals with
>>> strings? (...)
>>>
>>
>> I'm not 100% sure what your question is, but the help for strsub() says
>> to use the regsub() function for more complex stuff, so that would probably
>> be my advice.
>>
>
> Dear Sven, thanks for your attention!
>
> I tested with the resub and I got no success. Take a look at the following
> code:
>
> string Texto = sprintf("\n\
> O meu nome é 'Severino',\n\
> como não tenho outro de pia.\n\
> Como há muitos 'Severinos',\n\
> que é santo de romaria,\n\
> deram então de me chamar\n\
> 'Severino de Maria'.")
>
> string Texto1 = strsub(Texto, "'", "*")
> print Texto1
>
> string Texto2 = regsub(Texto, "'", "\"")
> print Texto2
>
> We can generate Texto1, but Texto2 fails.
>
> Best,
> Henrique
>
>
> _______________________________________________
> Gretl-users mailing list
> Gretl-users at lists.wfu.edu
> http://lists.wfu.edu/mailman/listinfo/gretl-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wfu.edu/pipermail/gretl-users/attachments/20150518/8dcdfcc6/attachment.html>


More information about the Gretl-users mailing list