I need to delete any condition associated with date from "where" block from pl sql query. I use python re library and re.sub() function.
Ass rexp pattern, I've wrote this regular expression:
((?<=where)|(?<=and))[^()]*?\w*date\w*.*?((and)|(?=order|where|left|right|inner|join|full))
And this is an example where it works not correct: https://regex101.com/r/HMAWI8/1
As you can check, with this pattern part: a.f_funid = b.f_funid and, are selected for some reason as part of a larger match a.f_funid = b.f_funid and a.begin_date <= to_date('11.11.1111 01:00:50','dd.mm.yyyy hh24:mi:ss') and despite of and part which should separate it, in my opinion. And I can't get why it ignoring first and part.
As result i want to get this row:
select any from (select any from some where a.f_funid = b.f_funid) r left join ods.account_h a on r.f_account_id = a.f_account_id where r.f_picture in (select r.f_picture from ods.RELATION_h r, ods.CALENDAT_h c, ods.REV_h rev where c.F_REVALUATIONID = rev.F_REVALUATIONID) and lower(f_name) = 'smth') and union all
I tried to use negative lookaround instead of .*? and [^()] parts, but seems it's a wrong way to solve this. I'm at a dead end right now.