MatchText, MatchChunk and the needle in the haystack

Jim Ault JimAultWins at yahoo.com
Sun Mar 18 19:37:41 EDT 2007


A simplistic approach would be to find the "-mth-" string and work from
there

on untested
  put "-Jan- -Feb- -Mar-" into mthStrings
  repeat for each word MTH in mthStrings
    put 1 into pos
    repeat until pos = 0
      put offset(mth, textBlock, pos+2) into pos
      put cr into char pos - 2 of textBlock
    end repeat
    
  end repeat
  --now textBlock should have cr's in the right spots
end untested

Jim Ault
Las Vegas


On 3/18/07 4:12 PM, "Bryan McCormick" <bryan at deepfoo.com> wrote:

> Folks,
> 
> I have been given a batch of text files that have had their delimiters
> stripped off (by accident) leaving a single string of text to parse back
> into record delimited form. And yes, of course, there is no back-up so
> it is the strings or nothing.
> 
> I really know very little about using RegEx, but I presume this could at
> least in part solve the problem.
> 
> Basically the only good news is that each record was originally
> delimited in the form of "24-Jan-02" so that as long as each date could
> be plucked out of the string it ought to be possible to grab the offset
> and then introduce a return before the next date occurrence. As in the
> text is 06-Mar-92therewasamangledbitoftexttodealwith02-Apr-92therest...
> 
> I cannot seem to get the MatchText to work properly to identify these,
> but I guess really the problem is I still need to find an offset for
> each. Is MatchText even the right thing to use? Can I use it in
> conjunction with 
> offset(MatchText(myVar,[0-9]-(Jan|Feb|Mar...|Dec)-[0-9],someVar)) to
> find each one?
> 
> Or is this a case where the string has to be brute forced?
> 
> Any ideas on how to proceed? Any ideas, snippets would be greatly
> appreciated.
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution





More information about the use-livecode mailing list