chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] Re: Regex help.


From: Matthew Welland
Subject: Re: [Chicken-users] Re: Regex help.
Date: Sat, 1 Mar 2008 14:55:19 -0700
User-agent: KMail/1.9.6 (enterprise 0.20070907.709405)

On Saturday 01 March 2008 10:10:54 am Hans Nowak wrote:
> Disclaimer: I'm still rather new to Chicken, etc, but it seems to me that
> things would be clearer using a regex-literal:
>
> #;6> (use regex-literals)
> ; loading /usr/local/lib/chicken/3/regex-literals.so ...
> #;7> (string-match #/^\\(.*)\s*$/ "\\foo ")
> ("\\foo " "foo ")
>
> Of course the .* match is greedy, so it matches any spaces after "foo" as
> well, which may or may not be your (Matthew's) intention.  If not, this
> might work:
>
> #;8> (string-match #/^\\(.*?)\s*$/ "\\foo ")
> ("\\foo " "foo")

regex-literals looks great! I hadn't noticed it before. Thanks for pointing 
it out.




reply via email to

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