GRegex in GLib

This morning I committed GRegex to svn, so glib 2.14 will have regular expression support. GRegex is a wrapper around the PCRE library by Philip Hazel that has several interesting features:

GRegex has a nice GLib-ish API that wraps PCRE functions and adds other features:

8 thoughts on “GRegex in GLib

  1. GLib lacks a good priority queue (heap queue) implementation. There are many areas where this would be a big benefit, especially since this would allow the implementation of a better scalabale main loop implementation that behaves better with large numbers of time events. Right now the GLib main loop is rather difficult to use efficiently if you have lots of time events.

    Like

  2. Neat, I guess. But it’s hard to get excited about regexps in GLib, since everybody I know doing serious GNOME programming is using a high-level language that already has regexps.

    Also, it’s a bit of a downer to see PCRE right after reading about how much better the Thompson algorithm is (http://swtch.com/~rsc/regexp/regexp1.html).

    But if there’s demand for this, then it’s a worthwhile addition, so cheers.

    Like

  3. @me:
    Sorry, but I fail to understand how your comment relates to GRegex %-)

    @ken:
    Most of the code in GNOME is written in C and not in high-level languages, at least gnumeric, libvte, anjuta and gtksourceview are currently using PCRE or GNU regexp. There are other programs such as gnome-system-monitor that would like to use PCRE but they can’t because it’s not a blessed dependency.

    BTW the Thompson algorithm is so fast for pathological cases but it makes hard to support things like Unicode, backreferences, zero-width assertions, etc.

    @Jesus:
    Yes, but it can’t be a one-liner, it’s C not PHP 🙂

    Like

  4. The bright side is that if a bunch of programs use GRegex, then it would be possible to write a Thompson implementation and just plug it in! 🙂

    Like

Comments are closed.