Have a large text file and I want to capture all text with the following conditions
i.e.any text that has "from" and "on" (all text between these words) - example ..
"select * from table1
inner join table 2 on t1.id = t2.id
when the test data is from wherever and
my data is on alert then
so, I want the following returned ... a single row for each capture
from table1 inner join table 2 on
from wherever and my data is on
my attempt so far ..
File.open("c:/regex.txt").each do |f|
if f =~/(?<=from[\s\w\d\r\n])+(?=on)+/i then