lilypond-user
[Top][All Lists]
Advanced

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

non-greedy regexp don't seem to work


From: Michael Gerdau
Subject: non-greedy regexp don't seem to work
Date: Thu, 21 May 2015 14:10:22 +0200
User-agent: KMail/4.14.8 (Linux/4.0.4-1-ARCH; KDE/4.14.8; x86_64; ; )

Hi list,

the following two statements should provide the exakt same strings:
(match:substring (string-match "_(.*?)_" "a_ä_ö_de_fü_") 1)
(match:substring (string-match "_([^_]*)_" "a_ä_ö_de_fü_") 1)

However for me they don't. Here is a log how I tested it:
$ guile
GNU Guile 2.0.11                                                                
                                                          
Copyright (C) 1995-2014 Free Software Foundation, Inc.                          
                                                          
                                                                                
                                                          
Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
This program is free software, and you are welcome to redistribute it
under certain conditions; type `,show c' for details.

Enter `,help' for help.
scheme@(guile-user)> (match:substring (string-match "_(.*?)_" 
"a_ä_ö_de_fü_") 1)
$1 = "ä_ö_de_fü"
scheme@(guile-user)> (match:substring (string-match "_([^_]*)_" 
"a_ä_ö_de_fü_") 1)
$2 = "ä"
scheme@(guile-user)> ,q

I checked the same regexps in Perl and there both results are the same.

Am I overlooking the obvious or is this a bug ?

Best wishes,
Michael
-- 
 Michael Gerdau       email: address@hidden
 GPG-keys available on request or at public keyserver

Attachment: signature.asc
Description: This is a digitally signed message part.


reply via email to

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