realbasic-nug
[Top] [All Lists]

Re: RegEx & CSV issue

To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: RegEx & CSV issue
From: Charles Yeomans <charles at declareSub dot com>
Date: Tue, 27 Feb 2007 15:33:15 -0500
Delivered-to: listarchive at realsoftware dot com
Delivered-to: realbasic-nug at lists dot realsoftware dot com
References: <6CC30485-A505-46E5-8736-DF86653F38BF at nc dot rr dot com> <EF8D6138-0BDB-4D89-9072-32E88792276D at great-white-software dot com> <6F18D3AE-171E-4CCC-BB1D-2D6619E5759F at nc dot rr dot com> <464CE94B-1F14-41F7-B864-96D27D3F5601 at declareSub dot com> <A436A56D-2577-4B0E-9100-B4CF07834734 at nc dot rr dot com>



On Feb 27, 2007, at 3:12 PM, Christian Miller wrote:

> On Feb 26, 2007, at 12:38 PM, Charles Yeomans wrote:
>>> Hi Norman, yes, I'm reading those entries from a file.  Can you tell
>>> me why the RegExMatch won't loop through the entire line?
>>
>> It's not designed to do so.  You need to loop yourself, if I
>> understand your question correctly.
>
> I'm no RegEx guru, but I thought if "greedy" was turned on, then when
> I searched, RegExMatch would find all matches for me.


No.  When "greedy" is set, a RegEx object will look for the longest  
possible match.  Consider the following example.

Source = "(((foo)))"
Regular Expression = "\(.+\)"

With Greedy = true, the match string will be "(((foo)))".  If Greedy  
= false, then the match string will be "(((foo)".

------------------------
Charles Yeomans
http://www.declareSub.com/
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>


From  Tue 27 Feb 2007 13:36:12 -0700
Return-Path: <realbasic-nug-bounces at lists dot realsoftware dot com>
X-Original-To: listarchive at realsoftware dot com
Delivered-To: listarchive at realsoftware dot com
Received: by xmail.realsoftware.com (Postfix, from userid 1037)
        id AE9A81AB1D2D; Tue, 27 Feb 2007 12:36:24 -0800 (PST)
X-Spam-Checker-Version: SpamAssassin 3.1.1 (2006-03-10) on 
        www.realsoftware.com
X-Spam-Level: 
X-Spam-Status: No, score=-2.6 required=4.5 tests=ALL_TRUSTED,AWL,BAYES_00,
        NO_REAL_NAME autolearn=ham version=3.1.1
Received: from lists.realsoftware.com (m.realsoftware.com [66.116.103.65])
        by xmail.realsoftware.com (Postfix) with ESMTP id 6A9981AB1D12;
        Tue, 27 Feb 2007 12:36:18 -0800 (PST)
Received: from m.realsoftware.com (localhost [127.0.0.1])
        by lists.realsoftware.com (Postfix) with ESMTP id 2BCC9FADCA;
        Tue, 27 Feb 2007 14:36:14 -0600 (CST)
X-Original-To: realbasic-nug at lists dot realsoftware dot com
Delivered-To: realbasic-nug at lists dot realsoftware dot com
Received: from mail.verex.com (mail.verex.com [66.116.103.197])
        by lists.realsoftware.com (Postfix) with ESMTP id 7C235FADBF
        for <realbasic-nug at lists dot realsoftware dot com>;
        Tue, 27 Feb 2007 14:36:12 -0600 (CST)
Received: from [66.116.103.197] (localhost [127.0.0.1])
        by mail.verex.com (Postfix) with SMTP id 61C8E7023A5
        for <realbasic-nug at lists dot realsoftware dot com>;
        Tue, 27 Feb 2007 13:36:12 -0700 (MST)
Date: Tue, 27 Feb 2007 13:36:12 -0700
Subject: Re: RegEx & CSV issue
From: joe at strout dot net
To: realbasic-nug at lists dot realsoftware dot com
In-Reply-To: <A436A56D-2577-4B0E-9100-B4CF07834734 at nc dot rr dot com>
X-Mailer: VerEx Email Gateway
Message-Id: <20070227203612 dot 61C8E7023A5 at mail dot verex dot com>
X-BeenThere: realbasic-nug at lists dot realsoftware dot com
X-Mailman-Version: 2.1.9
Precedence: list
Reply-To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: realbasic-nug-bounces at lists dot realsoftware dot com
Errors-To: realbasic-nug-bounces at lists dot realsoftware dot com

On Feb 27, 2007, at 20:12 UTC, Christian Miller wrote:

> > It's not designed to do so.  You need to loop yourself, if I
> > understand your question correctly.
> 
> I'm no RegEx guru, but I thought if "greedy" was turned on, then when
> I searched, RegExMatch would find all matches for me.

No, that's not what Greedy means at all.  Greedy affects the way
matching is done.  The individual Subexpressions returned reflect parts
of the match, not subsequent matches.  Subsequent matches are found by
calling .Search again.

You seem to be laboring under multiple misconceptions about how RegEx
works, which is going to make forward progress difficult.  I'd suggest
throwing out all your assumptions and doing a careful re-reading of the
documentation on them again.  Or, perhaps better yet, find a good
introduction to the topic, perhaps in RB Developer or some similar
resource.

Best,
- Joe

--
Joe Strout -- joe at strout dot net
Verified Express, LLC     "Making the Internet a Better Place"
http://www.verex.com/

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>


<Prev in Thread] Current Thread [Next in Thread>