guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Guile regular expressions are too greedy


From: Chris Dennis
Subject: Guile regular expressions are too greedy
Date: Wed, 22 Jul 2009 11:05:27 +0100
User-agent: Thunderbird 2.0.0.22 (X11/20090608)

Hello Guile People

Is there a way to make Guile regular expressions less greedy? I understand that POSIX doesn't define non-greedy modifiers.

Specifically, I'm trying to parse font names such as

    Arial 12
    Arial Bold Italic 14
    Nimbus Sans L Bold Italic Condensed 11

so that I can construct CSS styles from them.

I've tried the following, but the first (.*) gobbles up everything before the size because the other elements are optional:

(define s (string-match "(.*)( +(bold|semi-bold|regular|light))?( +(italic|oblique))?( +(condensed))? +([0-9]+)" "nimbus sans l bold italic condensed 11"))


Are there other ways of doing this?

cheers

Chris
--
Chris Dennis                                  address@hidden
Fordingbridge, Hampshire, UK




reply via email to

[Prev in Thread] Current Thread [Next in Thread]