Hi Paul,

AFAIK you need to deal with an hybrid approach (regex + livecode)

So, here is one way to do it:

   put 3 into pPage

   repeat for each line T in tCiCData

      if matchText( T, "(?x) \t (\d+) , \d+ ,  (\d+)  , \d+ \z", n1, n2)

      if (n1 <= pPage) and (n2 >= pPage) then

          put T & cr after tCiCfilteredData

      end if

      end if

   end repeat

   put tCiCfilteredData

But for the curious with an open-mind here is another solution:

   get "perl -ne 'print if /\t(\d+),\d+,(\d+),\d+$(?(?{$1>PP ||

   get replaceText( IT, "PP", pPage)

   put shell( IT && "/your/path/CiCData.txt")

What? the regex do the comparison!
Well yes and no; in Perl we can embed Perl code *inside* the regex,
like: (?{$1>PP || $2<PP})

$1>PP || $2<PP is a Perl expression.

As we have a mixture of a regex pattern and some perl code;
that is in fact another hybrid solution.

And of course, you can do it  using only chunks , item and so on...

Have fun,


2017-06-04 17:35 GMT+02:00 Paul Dupuis via use-livecode <

> I have a tab and cr delimited table of data, a sample line of which is
> below:
> 1<tab>Test<tab>4052,12594<tab>1,4052,3,2388<cr>
> Can someone help me revise this regex to match what I need?
> Thank you kindly, in advance.

Thierry Douez - sunny-tdz.com
sunnYrex - sunnYtext2speech - sunnYperl - sunnYmidi - sunnYmage
use-livecode mailing list
Please visit this url to subscribe, unsubscribe and manage your subscription 

Reply via email to