Is there any way to recognize the SP name as well as all parameter name and type? The regex pattern I used can only recognize the SP name and the last parameter name. I'll be appreciated if anyone can provide an regex that is able to recognize the SP name along with all the parameter names.
Pattern:
.*create procedure\s+.*\.\[(?<spname>\w+)\].*\((.*(?<aname>\@\w+)\s+(?<atype>\w+).*)\).*procedure
Below is the target string:
IF EXISTS (SELECT * FROM sysobjects WHERE id = OBJECT_ID('SPNameToBeRecognized') AND OBJECTPROPERTY(id, 'IsProcedure') = 1)
DROP PROCEDURE SPNameToBeRecognized
GO
CREATE PROCEDURE [dbo].[SPNameToBeRecognized]
(
@FirstArg DATETIME = NULL,
@SecondArg DATETIME = NULL,
@ThirdArg SMALLINT = 814,
@FouthArg SMALLMONEY = 10.00
)
/*----------------------------------------------------------------------------------------------------
Procedure :