From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Chris Dennis Newsgroups: gmane.lisp.guile.user Subject: Guile regular expressions are too greedy Date: Wed, 22 Jul 2009 11:05:27 +0100 Message-ID: <4A66E467.2060709@btinternet.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1248257155 14570 80.91.229.12 (22 Jul 2009 10:05:55 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 22 Jul 2009 10:05:55 +0000 (UTC) To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Wed Jul 22 12:05:48 2009 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MTYhm-0003tY-HW for guile-user@m.gmane.org; Wed, 22 Jul 2009 12:05:47 +0200 Original-Received: from localhost ([127.0.0.1]:58328 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MTYhm-00012P-0y for guile-user@m.gmane.org; Wed, 22 Jul 2009 06:05:46 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MTYhf-0000wd-Uz for guile-user@gnu.org; Wed, 22 Jul 2009 06:05:40 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MTYhZ-0000lN-MJ for guile-user@gnu.org; Wed, 22 Jul 2009 06:05:38 -0400 Original-Received: from [199.232.76.173] (port=47180 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MTYhY-0000ki-R8 for guile-user@gnu.org; Wed, 22 Jul 2009 06:05:32 -0400 Original-Received: from smtp814.mail.ird.yahoo.com ([217.146.188.74]:34290) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1MTYhX-00016T-QP for guile-user@gnu.org; Wed, 22 Jul 2009 06:05:32 -0400 Original-Received: (qmail 16420 invoked from network); 22 Jul 2009 10:05:29 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=btinternet.com; h=Received:X-Yahoo-SMTP:X-YMail-OSG:X-Yahoo-Newman-Property:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject:Content-Type:Content-Transfer-Encoding; b=qV5c0wN+6nY1Ve1RDK2vdx1uN9Hi60sMujkzZo8f3ILtyCjqIGyUaOxVFyGtaKFpHdNS/m3Vcnh5SVKBgQBIuwc+uno+saZuxI6nh7G0TMfCxv6qZIe2tZMFbbKOfN+W93XExe+4fBTdzE6jpOTnTfNUd5tcMKUXycLQLvU6X18= ; Original-Received: from unknown (HELO ?192.168.1.3?) (cgdennis@78.32.16.193 with plain) by smtp814.mail.ird.yahoo.com with SMTP; 22 Jul 2009 10:05:29 -0000 X-Yahoo-SMTP: HmaTfeyswBDGfPXlq_JtxoxwH5.3FMk49vfTMhfMJTiOLKkW X-YMail-OSG: L95d8_AVM1lJk0fQ1fyEgBRiFlEaNfyZfV6nz6cnMDlnKDLfGVkqvxI6r31Sp06sAbWNzNaZGDL1rGbQps.GsJGOKjGdeflrv2E3Pa5a936t2IxnQSVuTfnXwSx4_OOcZzlmLzgPi_n7m48Wotwizje4L8OGL0DgvXn3FHp02ZBVYWLiN5aboFSH4KY8L6LRxUJN9uMkKJbJ4AjyaGcG.h0SZQcUUPlY.rw_z5sez5PAjmMyZtSgqV8MbdP_yvdsXFQRybALTYc7fbs653ql3ZYC42MfLE51836qqcQBleqCkVZh2Qlco9ya1.jVwq9oCmwGL6oY X-Yahoo-Newman-Property: ymail-3 User-Agent: Thunderbird 2.0.0.22 (X11/20090608) X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:7366 Archived-At: 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 cgdennis@btinternet.com Fordingbridge, Hampshire, UK