I have a question that has asked before in this link, but there is no right answer in the link. I have some sql query text and I want to get all function's names (the whole name, contain schema) that has created in these. my string may be like this:
create function [SN].[FunctionName] test1 test1 ...
create function SN.FunctionName test2 test2 ...
create function functionName test3 test3 ...
and I want to get both [SN].[FunctionName] and SN.FunctionName, I tried this regex :
create function (.*?\]\.\[.*?\])
but this returns only the first statement, how can I make those brackets optional in the regex expression?