On Tue, 19 May 2015, Sven Schreiber wrote:
Am 19.05.2015 um 01:02 schrieb Hélio Guilherme:
> After digging down the code, there is a solution to your problem. You
> have to use the octal representation for the replacing character.
> The following code will replace single quotes for double quotes:
> string Texto2 = regsub(Texto, "[']", "\0042") print Texto2
>
> --- Leaving the regsub code as is, maybe the documentation should be
> improved. Get it from
>
https://developer.gnome.org/glib/stable/glib-Perl-compatible-regular-expr...
>
> If Allin or Jack want me to have a try to improve the regex
> processing I could have a go.
>
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>
<output>
? string s1 = sprintf("string with \"quoted\" bit")
Generated string s1
? print s1
string with "quoted" bit
? string s2 = regsub(s1, "\"", "*")
Generated string s2
? print s2
string with *quoted* bit
</output>
Allin