matchchunk

Ken Ray kray at sonsothunder.com
Wed Jul 16 11:40:01 EDT 2003


Richard,

You need to pass variables to hold the start/end chunk in the matchChunk
command (they don't need to have a value), but the regular expression needs
to have parentheses around the value you want to look for so it can
"extract" its location into the two variables. Like this:

on mouseUp
  local b,c
  put "abcdefg" & return & "hijk" into a
  put matchchunk(a, "(def)", b, c) into x
  put b && c && x
end mouseUp

Ken Ray
Sons of Thunder Software
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/


> From:     Richard Adams <rja46 at cam.ac.uk>
> Reply-To: use-revolution at lists.runrev.com
> Date: Wed, 16 Jul 2003 16:50:38 +0100
> To:     use-revolution at lists.runrev.com
> Subject: matchchunk
> 
> Dear All,
> 
> put "abcdefg"& return & "hijk" into a
> put 1 into b
> put 1 into c
> put matchchunk(a, "def", b,c) into x
> put b && c && x
> 
> Gives '  true'
> 
> I cannot work out what I am doing wrong here. I want to find the
> location of matched text in a list but I do not get values returned. I
> am sure there is a simple solution. Suggestions?
> 
> Many thanks, Richard.
> 
> 
> -- 
> Richard J Adams              e: rja46 at cam.ac.uk
> Department of Anatomy        t: +44 1223 333782
> University of Cambridge      f: +44 1223 333786
> Downing Street
> Cambridge, CB2 3DY
> UK
> 
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list