Hello Lee,
After consulting our product group, I finally got the right answer for this
question. :)
The expression ^:Wh*Dim Result in our VS Regular expression view breaks
down into the following:
At the beginning of the line (^), one or more white-space occurances (:Wh*)
followed by the words "Dim Result". Note that white space means any white
space characters, including line breaks, tabs, etc.
In your example, we returned the line previous to "Dim Result as Short" as
well as "Dim Result" because that empty line had a whitespace (line break)
at the beginning of the line. This was then followed by the white space
(tab) at the beginning of the "Dim Result" line. Because of the "^:Wh*",
we wanted zero or more occurances of a white space at the beginning of the
line. Therefore, both lines were selected.
Also, it should be noted that in VS Find/Replace, we use our own version of
regular expressions. The Visual Studio Expression syntax can be found
under the help topic
ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/vsintro7/html/vxgrfRegularExp
ressionsS.htm
(An easy way to get to this topic is click the expression builder button
(the right arrow located beside the Find What: combobox), then click on
"Complete character list")
In the example above, since the white spaces before "Dim Result" was
actually just a tab, then ^[\t]*Dim Result would return ok, since we are
looking for zero or more occurances of a tab at the beginning of a line
followed by Dim Result.
For ^[\s]*Dim Result, it returned "Specified Text wasn't found" because if
you look at our supported syntax, \s is not supported. In essense, you
were just looking for zero or more occurances of "s" at the beginning of
the line followed directly by Dim Result.
For us, the solution is to explicitly state that you want the search to be
contained in a line. This can be done by the following regular expression
^~(\n):Wh*Dim Result This statement says give me any match where the
beginning of the line doesn't contain a line break, contains zero or more
occurances of any white space, followed by Dim Result.
Does that answer your question? Thanks very much for working with us so
closely.
Best regards,
Yanhong Huang
Microsoft Community Support
Get Secure! ¨C
www.microsoft.com/security This posting is provided "AS IS" with no warranties, and confers no rights.