matchText question

Peter Haworth pete at lcsql.com
Wed Feb 25 22:09:17 CET 2015


Good catch.  I think the "*" in the original version referred to "\w+" so
that's probably what messed it up.

On Wed Feb 25 2015 at 12:30:15 PM Mike Bonner <bonnmike at gmail.com> wrote:

> Try this instead..
>     put "(?i)^\s*(\-\-\s+begin)\s+(\w+).*+|" & \
>          "^\s*(on)\s+(\w+).*+|" & \
>          "^\s*(function)\s+(\w+).*+|" & \
>          "^\s*(command)\s+(\w+).*+|" & \
>          "^\s*(private\s+function)\s+(\w+).*+|" & \
>          "^\s*(private\s+command)\s+(\w+).*+|" & \
>          "^\s*(\/\*\s+include).*+|" &  \
>           "^\s*(\*\/).*+" \
>          into expr
>
> You are using an * to match anything, but for some reason it seems to be
> messing things up.  If you add the . (period) before it to match any char,
> then the asterisk knows what its matching any number of.  (impressive
> sentence ending there)
>
> Have tested a little, it seems to solve it, though i'm not sure why.
>
> On Wed, Feb 25, 2015 at 12:45 PM, Michael Doub <mikedoub at gmail.com> wrote:
>
> > Am I doing something really crazy here?  There is no way that the result
> > will be true.   Replace the " hhh "  with "*/" and you still get true but
> > it is not doing the capture.   Replace the " hhh " with "function foo"
> and
> > you get an expected response.
> >
> > Should I even expect alternatives to be supported?
> >
> > -= Mike
> >
> >
> > on mouseUp
> >     put "(?i)^\s*(\-\-\s+begin)\s+(\w+)*+|" & \
> >          "^\s*(on)\s+(\w+)*+|" & \
> >          "^\s*(function)\s+(\w+)*+|" & \
> >          "^\s*(command)\s+(\w+)*+|" & \
> >          "^\s*(private\s+function)\s+(\w+)*+|" & \
> >          "^\s*(private\s+command)\s+(\w+)*+|" & \
> >          "^\s*(\/\*\s+include)*+|" & \
> >           "^\s*(\*\/)*+" \
> >          into expr
> >     get MatchText(" hhh ",expr,r1,r2,r3,r4,r5,r6,r7,
> > r8,r9,r10,r11,r12,r13,r14)
> >    answer it & cr & r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12,r13,r14
> > end mouseUp
> >
> > _______________________________________________
> > use-livecode mailing list
> > use-livecode at lists.runrev.com
> > Please visit this url to subscribe, unsubscribe and manage your
> > subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
> >
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>


More information about the use-livecode mailing list