Regex help...

Paul Dupuis paul at researchware.com
Sun Jun 4 11:35:44 EDT 2017


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.






More information about the use-livecode mailing list