Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
PCRE (PHP <7.3)

/
(?x) .+(?:Sub|Function)\ (\w+)\( # method declaration (?: # start of parameter pattern [\w\W]*?(?<=\b) # parameter may be preceded by ByVal or Optional keywords ([a-z]\w+)+ # parameter starts with a lower case .*? # parameter may be followed by its type declaration (?:=\ ([^\,]+)){0,1} # optional parameters may be followed by default value, it is captured to be used in method call (?:,|\)) # parameter is followed by , or ) ){0,1} # end of parameter pattern (may be copy-pasted infinitely to capture all parameters) (?: # start of parameter pattern [\w\W]*?(?<=\b) # parameter may be preceded by ByVal or Optional keywords ([a-z]\w+)+ # parameter starts with a lower case .*? # parameter may be followed by its type declaration (?:=\ ([^\,]+)){0,1} # optional parameters may be followed by default value, it is captured to be used in method call (?:,|\)) # parameter is followed by , or ) ){0,1} # end of parameter pattern (may be copy-pasted infinitely to capture all parameters) (?: # start of parameter pattern [\w\W]*?(?<=\b) # parameter may be preceded by ByVal or Optional keywords ([a-z]\w+)+ # parameter starts with a lower case .*? # parameter may be followed by its type declaration (?:=\ ([^\,]+)){0,1} # optional parameters may be followed by default value, it is captured to be used in method call (?:,|\)) # parameter is followed by , or ) ){0,1} # end of parameter pattern (may be copy-pasted infinitely to capture all parameters) (?: # start of parameter pattern [\w\W]*?(?<=\b) # parameter may be preceded by ByVal or Optional keywords ([a-z]\w+)+ # parameter starts with a lower case .*? # parameter may be followed by its type declaration (?:=\ ([^\,]+)){0,1} # optional parameters may be followed by default value, it is captured to be used in method call (?:,|\)) # parameter is followed by , or ) ){0,1} # end of parameter pattern (may be copy-pasted infinitely to capture all parameters) (?: # start of parameter pattern [\w\W]*?(?<=\b) # parameter may be preceded by ByVal or Optional keywords ([a-z]\w+)+ # parameter starts with a lower case .*? # parameter may be followed by its type declaration (?:=\ ([^\,]+)){0,1} # optional parameters may be followed by default value, it is captured to be used in method call (?:,|\)) # parameter is followed by , or ) ){0,1} # end of parameter pattern (may be copy-pasted infinitely to capture all parameters) (?: # start of parameter pattern [\w\W]*?(?<=\b) # parameter may be preceded by ByVal or Optional keywords ([a-z]\w+)+ # parameter starts with a lower case .*? # parameter may be followed by its type declaration (?:=\ ([^\,]+)){0,1} # optional parameters may be followed by default value, it is captured to be used in method call (?:,|\)) # parameter is followed by , or ) ){0,1} # end of parameter pattern (may be copy-pasted infinitely to capture all parameters) (?: # start of parameter pattern [\w\W]*?(?<=\b) # parameter may be preceded by ByVal or Optional keywords ([a-z]\w+)+ # parameter starts with a lower case .*? # parameter may be followed by its type declaration (?:=\ ([^\,]+)){0,1} # optional parameters may be followed by default value, it is captured to be used in method call (?:,|\)) # parameter is followed by , or ) ){0,1} # end of parameter pattern (may be copy-pasted infinitely to capture all parameters) (?: # start of parameter pattern [\w\W]*?(?<=\b) # parameter may be preceded by ByVal or Optional keywords ([a-z]\w+)+ # parameter starts with a lower case .*? # parameter may be followed by its type declaration (?:=\ ([^\,]+)){0,1} # optional parameters may be followed by default value, it is captured to be used in method call (?:,|\)) # parameter is followed by , or ) ){0,1} # end of parameter pattern (may be copy-pasted infinitely to capture all parameters) (?: # start of parameter pattern [\w\W]*?(?<=\b) # parameter may be preceded by ByVal or Optional keywords ([a-z]\w+)+ # parameter starts with a lower case .*? # parameter may be followed by its type declaration (?:=\ ([^\,]+)){0,1} # optional parameters may be followed by default value, it is captured to be used in method call (?:,|\)) # parameter is followed by , or ) ){0,1} # end of parameter pattern (may be copy-pasted infinitely to capture all parameters) (?: # start of parameter pattern [\w\W]*?(?<=\b) # parameter may be preceded by ByVal or Optional keywords ([a-z]\w+)+ # parameter starts with a lower case .*? # parameter may be followed by its type declaration (?:=\ ([^\,]+)){0,1} # optional parameters may be followed by default value, it is captured to be used in method call (?:,|\)) # parameter is followed by , or ) ){0,1} # end of parameter pattern (may be copy-pasted infinitely to capture all parameters) (?: # start of parameter pattern [\w\W]*?(?<=\b) # parameter may be preceded by ByVal or Optional keywords ([a-z]\w+)+ # parameter starts with a lower case .*? # parameter may be followed by its type declaration (?:=\ ([^\,]+)){0,1} # optional parameters may be followed by default value, it is captured to be used in method call (?:,|\)) # parameter is followed by , or ) ){0,1} # end of parameter pattern (may be copy-pasted infinitely to capture all parameters) (?: # start of parameter pattern [\w\W]*?(?<=\b) # parameter may be preceded by ByVal or Optional keywords ([a-z]\w+)+ # parameter starts with a lower case .*? # parameter may be followed by its type declaration (?:=\ ([^\,]+)){0,1} # optional parameters may be followed by default value, it is captured to be used in method call (?:,|\)) # parameter is followed by , or ) ){0,1} # end of parameter pattern (may be copy-pasted infinitely to capture all parameters) (?: # start of parameter pattern [\w\W]*?(?<=\b) # parameter may be preceded by ByVal or Optional keywords ([a-z]\w+)+ # parameter starts with a lower case .*? # parameter may be followed by its type declaration (?:=\ ([^\,]+)){0,1} # optional parameters may be followed by default value, it is captured to be used in method call (?:,|\)) # parameter is followed by , or ) ){0,1} # end of parameter pattern (may be copy-pasted infinitely to capture all parameters) (?: # start of parameter pattern [\w\W]*?(?<=\b) # parameter may be preceded by ByVal or Optional keywords ([a-z]\w+)+ # parameter starts with a lower case .*? # parameter may be followed by its type declaration (?:=\ ([^\,]+)){0,1} # optional parameters may be followed by default value, it is captured to be used in method call (?:,|\)) # parameter is followed by , or ) ){0,1} # end of parameter pattern (may be copy-pasted infinitely to capture all parameters) (?: # start of parameter pattern [\w\W]*?(?<=\b) # parameter may be preceded by ByVal or Optional keywords ([a-z]\w+)+ # parameter starts with a lower case .*? # parameter may be followed by its type declaration (?:=\ ([^\,]+)){0,1} # optional parameters may be followed by default value, it is captured to be used in method call (?:,|\)) # parameter is followed by , or ) ){0,1} # end of parameter pattern (may be copy-pasted infinitely to capture all parameters)
/
gms

Description

all variable names are found in method signature and listed

  • csv list is generated
  • a column of variable names preceded with line comment signt (') is generated
Submitted by anonymous - 6 years ago