Hi
Chris said:
Hi Jared,
I'm using Regex Buddy right now for testing. I also already have
Expresso, The Regulator, and the RegEx Designer...I've been going crazy
trying to get some help.
Dim ssnRegex As String = "^(?!000)([0-6]\d{2}|7([0-6]\d|7[012])) ([ -])?
(?!00)\d\d([ -|])? (?!0000)\d{4}$"
Your problem is here. You should define the regular expression like this:
Dim ssnRegex As String = "(?!000)([0-6]\d{2}|7([0-6]\d|7[012])) ([ -])?
(?!00)\d\d([ -|])? (?!0000)\d{4}"
^ and $ defines the start and end of the text to check, not the start and
end of the reg. expression.
Dim options As System.Text.RegularExpressions.RegexOptions =
System.Text.RegularExpressions.RegexOptions.Multiline
Dim oSSNRegex As New Regex(RegExTypes.ssnRegex, RegExTypes.options)
Inside Regex Buddy, or any of the others, if I use their method to import
the text from a test file everything works great and the RegEx returns a
match. However, when I view the debugger in Visual Studio and take a look
at the string I see all of the square like VbCrLf's in with the string
that represents the file I'm testing. If I paste the string that
represents the file I'm testing from the watch list in Visual Studio to
Regex Buddy, or any of the others, the RegEx fails to make a match.
Additionally, I've also tried replacing all of the VbCr and VbLf's with
just a blank space " ".
Here is a representation of the filecontents I'm looking at (from inside
the Visual Studio debugger). I've replaced all of the actual VbCrLf's
with readable values:
FileContents = "Microsoft (R) Windows Script Host Version
5.6vbCrLfCopyright (C) Microsoft Corporation 1996-2001. All rights
reserved.vbCrLfvbCrLfUsing Path: \\WKS3A\c$\Documents and
Settings\Diana.CFLLAW\Application Data\Express\SendvbCrLfResults for:
WKS3A - Diana.CFLLAWvbCrLfvbCrLfThe MEAN dictation file size: 0
MBvbCrLfvbCrLfLargest File: 0 MBvbCrLf1 files considered in
average.vbCrLfvbCrLf============================================vbCrLfvbCrLfvbCrLfUsing
Path: \\WKS5A\c$\Documents and Settings\Diana.CFLLAW\Application
Data\Express\SendvbCrLfResults for: WKS5A - Diana.CFLLAWvbCrLfvbCrLfThe
MEAN dictation file size: 0 MBvbCrLfvbCrLfLargest File: 0 MBvbCrLf1 files
considered in
average.vbCrLfvbCrLf============================================vbCrLfvbCrLf134
73 9834vbCrLfvbCrLfvbCrLf"
Does this information help in figuring out what I'm doing wrong?
Thanks,
Chris
Lars