E
ELI
I have a simple regexp that I want to use to format a SQL statement.
#want to format the following:
select
--to_char(last_analyzed,'HH:MI:SS PM')
*
from
user_indexes ui
where
UPPER(ui.index_name) = UPPER('fact_cnpt_pat_enct_idx')
group by
some column
order by
some other column
#to be converted to the following format:
select
--to_char(last_analyzed,'HH:MI:SS PM')
*
from
user_indexes ui
where
UPPER(ui.index_name) = UPPER('fact_cnpt_pat_enct_idx')
group by
some column
order by
some other column
#basically this should take all of the NON-SQL structures (select,
from, where, group, order) and indent them.
# so far, the only thing I've managed to do is move the SQL
structures, using the following REGEXP
#this basically inserts a \t (tab) for every occurence
\(^\(select\|from\|where\|order\|group\)\)
\t\1
#QUESTION -----------------
# is there a way to say "give me everything (in a backreference) that
is NOT found within the expression" -
# basically it needs to be the opposite of it's current logic, but I'm
not sure how to do that. Suggestions?
#want to format the following:
select
--to_char(last_analyzed,'HH:MI:SS PM')
*
from
user_indexes ui
where
UPPER(ui.index_name) = UPPER('fact_cnpt_pat_enct_idx')
group by
some column
order by
some other column
#to be converted to the following format:
select
--to_char(last_analyzed,'HH:MI:SS PM')
*
from
user_indexes ui
where
UPPER(ui.index_name) = UPPER('fact_cnpt_pat_enct_idx')
group by
some column
order by
some other column
#basically this should take all of the NON-SQL structures (select,
from, where, group, order) and indent them.
# so far, the only thing I've managed to do is move the SQL
structures, using the following REGEXP
#this basically inserts a \t (tab) for every occurence
\(^\(select\|from\|where\|order\|group\)\)
\t\1
#QUESTION -----------------
# is there a way to say "give me everything (in a backreference) that
is NOT found within the expression" -
# basically it needs to be the opposite of it's current logic, but I'm
not sure how to do that. Suggestions?