MatchText, MatchChunk and the needle in the haystack
Jim Ault
JimAultWins at yahoo.com
Mon Mar 19 15:47:28 EDT 2007
On 3/19/07 10:49 AM, "Bryan McCormick" <bryan at deepfoo.com> wrote:
> Dave,
>
> Sadly it does not impact the outcome. Mind you I tried it just in case.
>
> I have played with all the vars that I can think of and it does nothing.
> It does not even appear to matter (as I thought) if there are multiple
> months (i.e "-Jan-") of the same type in a row (thought it might be
> finding the first and missing the others somehow, but no), it doesn't
> matter if the date is of xx-Month-xx, or x-Month-XX, nor does it matter
> the order or how often these appear in the string and it doesn't seem to
> matter how long or short the record or the file happens to be.
>
> It should work as far as I can see. I am stumped at this point. It is an
> error for sure (on my end) it is just really subtle it seems. Or it will
> be until someone points the magic finger and says "here it is you idiot"!
A couple ideas
-1--- make sure that you are not changing the length of the textBlock with
replacements. This could accumulate to a significant offset error,
depending on how you build your loops.
-2--- test for null chars [00 ascii] used in some file formats
put length(textBlock) into origCharCnt
replace null with empty
answer length(textBlock) - origCharCnt
-3--- do inspections to see if something is creating a false hit or false
miss....
put the number of lines in textBlock into foundMth
repeat <for each month string, -Jan-, -Feb-, etc.>
replace "-Jan-" with cr &"Jan-" in textBlock
get the number of lines in textBlock - sum(foundMth)
put it &","after foundMth
breakpoint
--now inspect the textBlock & foundMth for any odd occurrences
-- optional is to filter textBlock without "*Jan-" thus purging as you go
end repeat
Jim Ault
Las Vegas
More information about the use-livecode
mailing list