Regex help...

Mike Bonner bonnmike at gmail.com
Sun Jun 4 14:11:42 EDT 2017


Not sure regex can do what you want, or if it can its far far over my
head.  Would it work instead to use lc script to parse?
If you repeat through your data (each line form, with tLine as the current
line and pPage as the page to be looked for...) you can use a one liner
like this to build a list of matching lines, chop the trailing cr
afterwards, and be done with it.

*if* item -2 of tLine >= pPage and item -4 of tLine <= pPage *then* *put*
tLine & cr after tNewDat


On Sun, Jun 4, 2017 at 9:35 AM, Paul Dupuis via use-livecode <
use-livecode at lists.runrev.com> wrote:

> 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>
>
> The last tab delimited item "1,4052,3,2388" is actually <Starting Page
> Number>,<Starting Position On Page>,<Ending Page Number>,<Ending
> Position On Page>
>
> So the starting page number is 1 and ending page is 3
>
> I have a variable pPage which contain a page number, say "2"
>
> My regex filter, that was crafted by someone else, needs to find (filter
> to just) all lines starting on page 2 OR ending on page 2 OR containing
> page 2 (ie, pPage is >= starting page and <= ending page)
>
> My existing filter, below, matched lines with starting page number and
> ending page numbers but not line with page numbers between the start and
> end.
>
>   put
> "(.+\t"&pPage&",\d+,\d+,\d+)|(.+\t\d+,\d+,"&pPage&",\d+)|(.+
> \t"&pPage&",\d*\.?\d*,\d*\.?\d*,\d*\.?\d*,\d*\.?\d*)"
> into tMatchPattern
>   filter lines of tCiCData with regex pattern tMatchPattern
>
> Can someone help me revise this regex to match what I need?
>
> Thank you kindly, in advance.
>
>
>
> _______________________________________________
> 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