SQL语句正则表达式匹配问题

SQL语句正则表达式匹配问题

1. mysql数据库, sql语句如下.  


1. ( SELECT i.* FROM `view_sn` AS i
 LEFT JOIN `tb_sn_visit` AS t
 ON i.snID = t.snID
 WHERE t.`Date` >= '2007-11-20'
 GROUP BY t.snID
 ORDER BY SUM( t.PC ) DESC )
 UNION
 ( SELECT i.* FROM `view_sn` AS i
 LEFT JOIN `tb_sn_visit` AS t
 ON i.snID = t.snID
 WHERE t.`Date` < '2007-11-20'
 GROUP BY t.snID
 ORDER BY SUM( t.PC ) DESC, i.snID DESC )
 LIMIT 1700, 20;



2. SELECT i.*, v.`PC`
 FROM `view_sn` AS i LEFT JOIN `view_sn_visit_count` AS v ON i.snID = v.sNID
 ORDER BY v.`PC` DESC, i.`snID` DESC
 LIMIT 0, 20;



2. 第一个sql语句里面有两个FROM, 第二个sql语句里面有一个FROM.
写的正则表达式, 如果匹配第一个sql语句的两个from, 第二条sql语句,就不能匹配了.  
如果只匹配一个FROM, 又不是想要的结果.


如何能写一个正则,可以匹配第一个语句中的两个 from  又可以匹配第二条语句中的一个from

谢谢..
请问你要匹配出什么东西呢
匹配 FROM
讲的不清楚 是m/\s+(FROM)\s+/g楼主也不会问