Find text in VB6 IDE at the beginning of a line

481 Views Asked by At

I am trying to search a large VB6 project for where a variable gets assigned. If I just use the Find dialog and enter the variable name in the “Find What” textbox, it opens many windows where the variable is used, but I would like to just get the lines where the variable is the first thing at the beginning of a line (where the variable is being assigned to).

I have tried using the “Use Pattern Matching” option, but I must not be using it correctly; when I search VB6 Help, it just says that option searches using pattern matching characters, without mentioning what "pattern matching characters" are allowed.

2

There are 2 best solutions below

4
MikeC On BEST ANSWER

A solution that uses the VB6 editor using the VB6 Find dialog with the "Use Pattern Matching" option, to find lines where an assignment to a variable is made is:

yourVariableName*=

where the wildcard pattern matching character is used. It doesn't actually require the variable name to be at the start of a line, and may give some extra hits, but is simple and easy to use within the VB6 code editor.

2
JSS On

If you can set your search mode to use regular expressions, you can indicate start of line with a caret. ie, the "^"

FOO at start of line would be found by entering ^FOO in the search box