0

How do I select a procedure written in classic asp with regular expression. For example:

Sub SubName
   'sub implementation having multi line statements. It may have comments also.
End Sub

How do I select the multi line procedure using the regular expression?

My objective: To obtain all the procedure listed in all ASP pages within a specified folder and merge it in one file. So I am searching for a regular expression that will yield procedures which I can collect and append in one file for debugging purposes.

Kashif Khan
  • 685
  • 2
  • 11
  • 30

2 Answers2

2

This will match a sub (assuming . matches all):

^\s*(Sub.*?)^\s*End Sub

This also assumes that there are no multiline comments, which Lankymart assures me can't happen, and that both Sub and End Sub are on their own line.

Community
  • 1
  • 1
SQB
  • 3,926
  • 2
  • 28
  • 49
1

How about: Sub SubName[\s\S]*?End Sub? See http://regex101.com/r/xP9kG3

Uri Y
  • 840
  • 5
  • 13