You could set your needle to be a valid LCS expression. I just ran a test using the following:
*do* "if (" & pNeedle & ") then put tPath into xFoundPaths[the number of elements in xFoundPaths + 1]" It took around 4x of the time to run though. I set my needle to "tElement > 5000" for one test and "tElement > 5000 and tElement < 5002" for another. Times were similar for each. With a roughly 10% cost per nested if inside the recursion loop, it would seem that specific helper functions would be needed for each type of search. I'm not sure if a switch would optimize it any. The wrapper function could be generalized and perform the if/switch once to select the appropriate private handler. Using matchtext for a simple "or" type doesn't seem to cost much more than using a nested if would. I tried a search using a needle of "(Chocolate|Maple)". I'm using example 5 from this site for my JSON: https://adobe.github.io/Spry/samples/data_region/JSONDataSetSample.html I can post a copy of the test stack I'm playing around with if anyone would be interested. On Sat, Aug 26, 2017 at 9:04 AM, Alex Tweedly via use-livecode < use-livecode@lists.runrev.com> wrote: > I think regex (or multiple string comparisons) is too limited a way to go. > > I would want to be able to do numeric comparisons, range comparisons, etc. > > e.g. x is a number, x<25, 24 < x < 33, etc. > > -- Alex. > > On 26/08/2017 05:05, Brian Milby via use-livecode wrote: > >> tElement isn't the part that would change (you are still searching against >> a single value in the array), you would need to modify the comparison to >> allow for pNeedle to contain multiple values and the operators. It would >> probably be easier to modify to use a RegEx. If you have 2 comma >> separated >> items, you could use something like the following (I'm sure the more >> experienced can offer much better ways though): >> >> *if* (tElement contains item 1 of pNeedle) or (tElement contains item 2 of >> pNeedle) *then* >> >> >> On Fri, Aug 25, 2017 at 10:41 PM, Sannyasin Brahmanathaswami via >> use-livecode <use-livecode@lists.runrev.com> wrote: >> >> OK I will bite >>> >>> what would an array representing an "AND/OR" >>> style query look like such that if used as a predicate >>> >>> for >>> >>> else if tElement contains pNeedle then >>> >>> it would return true/false >>> >>> How would you have to construct "tElement" >>> >>> ?? >>> >>> >>> >>> Mark: In terms of generalizing that function - then the key line which >>> checks >>> whether an element matches is: >>> >>> else if tElement contains pNeedle then >>> >>> >>> One could imagine that this could be an arbitrary predicate - >>> pNeedle >>> doesn't have to be a string, so could be an array representing a >>> AND / >>> OR style query; or could be a regex (in which case you'd use >>> matchText). >>> >>> _______________________________________________ >>> use-livecode mailing list >>> use-livecode@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@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@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@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode