[Javascript] OT: RegExp

Flavio Gomes flavio at economisa.com.br
Wed May 12 11:55:55 CDT 2004


Hello List,

  First I'd like to excuse me for asking off-topic stuff, but I know we 
have very good people at regular expressions here, and I'd get a fast 
and nice answear.

My problem is as follows:
 I need to replace everything in parenthesis on a string for nothing, 
*including parenthesis*

Example:
"  select name, (select 'subselect', 2+2 as sum, 5*3 as product from 
my_table)
  from another_table
  where number = (select id_nro from third_table where birthdate is not 
null) "
Should bring:
"  select name,
  from another_table
  where number =  "

Explanation:
 I got a program that receives a query as argument and redesign it to do 
a lot of stuff, like writing a table (html), recreating the sql, add 
order by and some other stuff, but when you set a subselect in the query 
it gets confused and don't know which seelect/from/where came from the 
original query.. so it can't put the "order by" and other clauses in the 
proper places.. and, by killing all select/from/where "in parenthesis" I 
hope to be able to find out which one is the "real" select/from/where 
for the query.


Thanks in advance,

-- 
Flavio Gomes
flavio at economisa.com.br




More information about the Javascript mailing list