MatchText, MatchChunk and the needle in the haystack

Bryan McCormick bryan at deepfoo.com
Sun Mar 18 19:12:01 EDT 2007


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.



More information about the use-livecode mailing list