--[^\r\n]*|/\*[\s\S]*?\*\/ (\/\*([^*]|[\r\n]|(\*+([^\*\/]|[\r\n])))*\*+\/)|(\/\/.*)|(\-\-(.*)[\r\n])|((.*)\*\/)
create function dbo.remove_comment(@definition nvarchar(max)) returns nvarchar(max) begin declare @start int = 0 , @next_start int , @end int while(1=1) begin set @end = charindex('*/', @definition) if @end = 0 break set @start = 0 while(1=1) begin set @start = charindex('/*', @definition, @start+1) set @next_start = charindex('/*', @definition, @start+1) if @next_start > @end or @next_start = 0 break end set @definition = stuff(@definition, @start, @end-@start+2, '') --select @definition --print concat('@start=', @start, ', @end=', @end) if @start = 0 break end return dw.dbo.rxreplace(@definition, '--[^\r\n]*', '', 1) end
<PackageName>aaa.dtsx</PackageName> <PackageName>aaa.txt</PackageName> <PackageName>aaa.dtsx <PackageName>aaa.dtsx</aaaPackageName> <html>aaaa bbb </html>
(?<=\<PackageName\>)[\w./]+\.dtsx(?=\<\/PackageName\>)
aaa.dtsx
<Cars> <Car id="1234"> <Make>Volkswagen</Make> <Model>Eurovan</Model> <Year>2003</Year> <Color>White</Color> </Car> <Car id="5678"> <Make>Honda</Make> <Model>CRV</Model> <Year>2009</Year> <Color>Black</Color> <Mileage>35,600</Mileage> </Car> </Cars>
<Car[\n\s\S]*?</Car>
<Cars> <Car id="1234"> <Make>Volkswagen</Make> <Model>Eurovan</Model> <Year>2003</Year> <Color>White</Color> </Car> <Car id="5678"> <Make>Honda</Make> <Model>CRV</Model> <Year>2009</Year> <Color>Black</Color> <Mileage>35,600</Mileage> </Car>
<html><img src="kk.gif" alt="text"/></html> <html><img src='kk.gif' alt="text"/></html> <html><img src = "kk.gif" alt="text"/></html>
<img[^>]+src\s*=\s*['"]([^'"]+)['"][^>]*>
<img src="kk.gif" alt="text"/> <img src='kk.gif' alt="text"/> <img src = "kk.gif" alt="text"/>
insert into [dw].[fact].[conn_users] insert into [Fact].conn_users insert into Fact.conn_users insert into fact.conn_users insert into dw.fact.conn_users insert into [dw].fact.[conn_users] insert into [dw].fact.[Conn users] insert into fact.conn_users insert fact.conn_users(cola, colb) update fact.conn_users insert dim.code(cola, colb)
(?<=insert(\s+into\s+|\s+))((\[|)\w+(\]|)|(\[|)\w+(\]|)|)(\.|)(\[|)(?i)fact(\]|)\.(\w+|\[[^\]]*])
(?<=insert(\s+into\s+|\s+))(\[\w+\]\.|\w+\.|)(\[|)(?i)(temp|fact|dim|etl|realtime|bill|dbo)(\]|)\.(\w+|\[[^\]]*])
[dw].[fact].[conn_users] [Fact].conn_users Fact.conn_users fact.conn_users dw.fact.conn_users [dw].fact.[conn_users] [dw].fact.[Conn users] fact.conn_users fact.conn_users
select * from dw.fact.tablex a inner join Dim.tabley b on a.id = b.id inner join [fact].tablec c on a.id = c.id select * from dw.etl.tablex a inner join realtime.tabley b on a.id = b.id inner join dbo.tablec c on a.id = c.id inner join bill.tablec d on a.id = d.id
(\w+\.|)(\[|)(?i)(fact|dim|etl|realtime|bill|dbo)(\]|)\.\w+
dw.fact.tablex Dim.tabley [fact].tablec dw.etl.tablex realtime.tabley dbo.tablec bill.tablec
insert into [dw].[fact].[conn_users] insert into [Fact].conn_users insert into Fact.conn_users insert into fact.conn_users insert into dw.fact.conn_users insert into [dw].fact.[conn_users] insert into [dw].fact.[conn users] insert into fact.conn_users insert fact.conn_users(cola, colb) update fact.conn_users insert dim.code(cola, colb)
(\[\w+\]\.|\w+\.|)(\[|)(?i)(temp|fact|dim|etl|realtime|bill|dbo)(\]|)\.(\w+|\[[^\]]*])
dw.fact.aaaa dw.[fact].aaaa fact.aaaa fact.[aaaa] Fact.AAAA [fact].[aaaa bbb] dw.[fact].[aaaa bbb] [dw].[fact].[aaaa bbb]
$()*+.?[\^{|
text <- "abcd $efg hig" pattern <- "\\$efg" unlist(regmatches(text, regexec(pattern, text)))
> unlist(regmatches(text, regexec(pattern, text))) [1] "$efg"
text <- "abcd efg hig" pattern <- "efg" unlist(regmatches(text, regexec(pattern, text)))
> unlist(regmatches(text, regexec(pattern, text))) [1] "efg"