Q1-PatIndex模式正則表達式:如何匹配後跟空格的點? Q2 -PatIndex模式正則表達式:如何匹配一個點後跟兩個空格?PatIndex模式/正則表達式:如何匹配後跟空格的點
我希望把它放在這裏只得到目標內容
Declare @Temp Table(Data VarChar(1000))
Insert Into @Temp Values('Lalallaa GOAL: This is the truthmeow. Meow. ')
Insert Into @Temp Values('Lalallaa GOAL: This is the truth. Meowrwr. ')
Insert Into @Temp Values('lALALLA GOAL: This is the truth. Meowrwr. NOTINCLUDED: WAWAW')
Select Left(
SubString(Data,PATINDEX ('%GOAL%',Data), 8000) ,
PatIndex('regex here', SubString(Data, PatIndex('%[GOAL]%', Data), 8000))-1)
From @Temp
期望輸出
GOAL: This is the truthmeow.
GOAL: This is the truth.
GOAL: This is the truth.
我用Shnugos答案的真實DB,我遇到了一個錯誤:Illegal name character
我檢查了數據類型,它是ntext
'\。\ s'(Q1)或'\。\ S {2}'(Q2)。羅傑出:) – Jan
在這個偉大的野外世界裏有很多教程和在線測試形式。 SO不是作業平臺... – Shnugo
預期產量是多少? –