Re: Generic character types of gregex are unrecognised

2009-01-10 Thread tks
> No - it's actually not obvious, especially since regular
> expressions are a separate type in some other languages.
>
> Liam

yeah, I'm almost always writing codes in Python these days and it
seems to put the manner of C out of my mind.
Thank you for your kindness.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Generic character types of gregex are unrecognised

2009-01-08 Thread Liam R E Quin
On Thu, 2009-01-08 at 17:43 +0900, tks wrote:
> > On Wed, 2009-01-07 at 02:00 +0900, tks wrote:
> > [...]
> >>   reg = g_regex_new ("\d\D\s\S\w\W",
> >>  0,
> >>  0,
> >>  &error);
> >
> >
> > Watch out that \ is special in C strings, so you need
> > \\d\\D etc.
> >
> > Liam
> 
> Thanks, I'm so stupid! :P

No - it's actually not obvious, especially since regular
expressions are a separate type in some other languages.

Liam

-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org www.advogato.org

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Generic character types of gregex are unrecognised

2009-01-08 Thread tks
> On Wed, 2009-01-07 at 02:00 +0900, tks wrote:
> [...]
>>   reg = g_regex_new ("\d\D\s\S\w\W",
>>  0,
>>  0,
>>  &error);
>
>
> Watch out that \ is special in C strings, so you need
> \\d\\D etc.
>
> Liam

Thanks, I'm so stupid! :P
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Generic character types of gregex are unrecognised

2009-01-06 Thread Liam R E Quin
On Wed, 2009-01-07 at 02:00 +0900, tks wrote:
[...]
>   reg = g_regex_new ("\d\D\s\S\w\W",
>  0,
>  0,
>  &error);


Watch out that \ is special in C strings, so you need
\\d\\D etc.

Liam


-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org www.advogato.org

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Generic character types of gregex are unrecognised

2009-01-06 Thread tks
Hi.
As long as reading
http://library.gnome.org/devel/glib/stable/glib-regex-syntax.html , we
can use generic character types of gregex such like "\s", "\d" etc...,
but they are not recognized in my sample code.
===
#include 
int main(int argc, char *argv[])
{
  GRegex *reg;
  GError *error = NULL;
  reg = g_regex_new ("\d\D\s\S\w\W",
 0,
 0,
 &error);
  return 0;
}

$ LANG=C gcc -g `pkg-config --cflags --libs glib-2.0` sample.c
sample.c:6:22: warning: unknown escape sequence '\d'
sample.c:6:22: warning: unknown escape sequence '\D'
sample.c:6:22: warning: unknown escape sequence '\s'
sample.c:6:22: warning: unknown escape sequence '\S'
sample.c:6:22: warning: unknown escape sequence '\w'
sample.c:6:22: warning: unknown escape sequence '\W'
=
How can I use them? Do I have to use verbose posix character classes instead?
I'm using glib-2.18.3 on Fedora 10 and glib seems to be compiled to
use internal version of PCRE.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list