RegExLib.com - The first Regular Expression Library on the Web!

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find VBScript Declaration
Expression
^[\s]*(?:(Public|Private)[\s]+(?:[_][\s]*[\n\r]+)?)?(Function|Sub)[\s]+(?:[_][\s]*[\n\r]+)?([a-zA-Z][\w]{0,254})(?:[\s\n\r_]*\((?:[\s\n\r_]*([a-zA-Z][\w]{0,254})[,]?[\s]*)*\))?
Description
Matches any VBScript method declaration (= no "As [datatype]" support), supports line wraps, only matches valid argument/method names, Public/Private and arguments are optional. First regex, please comment ;)
Matches
Sub Test() | Public Sub Test(arg1, arg2) | Public Sub _\r\nTest(arg1, arg2)
Non-Matches
"Function test()" | Sub 0815() | Sub_Test() | Sub Test(0815)
Author Rating: Not yet rated. Laurens Stötzel
Source
Your Rating
Bad Good

Enter New Comment

Title

Name

Comment

Spammers suck - we apologize. Please enter the text shown below to enable your comment (not case sensitive - try as many times as you need to if the first ones are too hard):

Existing User Comments

Copyright © 2001-2025, RegexAdvice.com | ASP.NET Tutorials