Contents

1 T-SQL 譯殊
2 一危 伎 螳 觸願鍵
3 蠏語 覓語 觸願鍵
4 蠏語 觸願鍵
5 SQL ろ襴渚語 insert 企 谿剰鍵
6 ろる.企
7 轟 覓語企 觸願鍵
8 html 蠏碁 觸願鍵
9 一危 覓語 蟲覿 csv
10 覦一(array)
11 覃覓語
12 蠍磯蓋 襷れ広
13 谿瑚


windows7 蟆曙企.
[http] 蟠朱 企 蠏, 螻企襯伎/ろ磯 襴覦伎(http://www.kyobobook.co.kr/product/detailViewKor.laf?ejkGb=KOR&mallGb=KOR&barcode=9788979147742&orderClick=LAG&Kc=) 襴 覲碁.

.Net 蠍一朱 .

https://regex101.com/library?orderBy=MOST_POINTS&page=2&search=&filterFlavors=dotnet

test

1 T-SQL 譯殊 #

--谿瑚: https://www.regextester.com/94246
https://regexr.com/4cgnu
--[^\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

2 一危 伎 螳 觸願鍵 #


"aaa"bbb ccc 
ddd"fff"


(?<=\")(.*?)(?=\")

蟆郁骸
aaa
fff

3 蠏語 覓語 觸願鍵 #


<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>

4 蠏語 觸願鍵 #

--豢豌: https://www.javaer101.com/article/4088123.html


<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"/>

5 SQL ろ襴渚語 insert 企 谿剰鍵 #

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

6 ろる.企 #

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]

7 轟 覓語企 觸願鍵 #

abc2
abc
 abc
first_abc
abc_level

(\s|)\babc\b

蟆郁骸
abc
 abc

8 html 蠏碁 觸願鍵 #

<a href="http://www.aaa.com">aaa.com</a><br><br>

<[^>]*>

9 一危 覓語 蟲覿 csv #

a,"bcd, efg",h,i

(?=(?:[^"]|"[^"]*")*$)

螳 蟲覿(split)
  • a
  • "bcd, efg"
  • h
  • i

10 覦一(array) #

expression
\[\d*(?:,\s*\d+)*\]

text
Name=伎, Skill=[1, 2,3]

蟆郁骸
[1, 2,3]


11 覃覓語 #

$()*+.?[\^{|

escape 覓語
text <- "abcd $efg hig"
pattern <- "\\$efg"
unlist(regmatches(text, regexec(pattern, text)))

> unlist(regmatches(text, regexec(pattern, text)))
[1] "$efg"

譬襭蟯(]), 危(-), 譬襭譴蟯(}) 覃 覓語 觜語. 譬襭蟯(]), 危(-) 伎れ危 豌襴讌 蟯([) れ 蟆曙一襷 覃 覓語襦 語覃, 譬襭譴蟯(}) 伎れ 豌襴讌 譴蟯({) れ 蟆曙一襷 覃覓語襦 語. 譬襭 蟯 ),},] 伎れ危 豌襴 殊 覃覓語襦 覿襯讌 .

12 蠍磯蓋 襷れ広 #

覓語伎 轟 願 讌
text <- "abcd efg hig"
pattern <- "efg"
unlist(regmatches(text, regexec(pattern, text)))

> unlist(regmatches(text, regexec(pattern, text)))
[1] "efg"

13 谿瑚 #