Given the below sample, how would I match each hyphen found between the words "CAST" and "DATETIME"? (CAST(N'2013-11-26 10:52:47.957' AS DateTime)
)
The pattern occurs multiple times per row. There could be hyphens anywhere else in the string that must not be matched.
INSERT [dbo].[tbl_Content] ([Template], [CreatedDate], [Url], [PublishedDate]) VALUES (N’gallery-item.aspx', CAST(N'2013-11-26 10:52:47.957' AS DateTime), N'some-url', CAST(N'2013-11-26 00:00:00.000' AS DateTime))
INSERT [dbo].[tbl_Content] ([Template], [CreatedDate], [Url], [PublishedDate]) VALUES (N’another-item.aspx', CAST(N'2013-11-26 10:52:47.957' AS DateTime), N'some-other-url', CAST(N'2013-11-26 00:00:00.000' AS DateTime))
CAST(.*)DateTime
selects all characters between the first occurrence of "CAST" and the last occurrence of "DATETIME" on each row. there could be other hyphens in this selection that shouldn't be matched.
-
will match any hyphen in the document.
I guess I need to combine these two patterns somehow but my regex knowledge is non-existent. CAST(-)DateTime
doesn't work.
What is the correct way to do this?
If platform is important: this will be used to do find-replace in Visual Studio Code. If this is not possible, I'm absolutely open to using another text/code editor.