Hi Cesar,
Thanks for the reply!
When I pasted the code into my project I got a get errors. After doing
whatever I had to do to make the errors go away I just wanted to make sure
that I didn't screw things up
Here is what I have now:
Dim regex As String =
"^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w ]*))+\.(txt|TXT)$"
Dim options As System.Text.RegularExpressions.RegexOptions = _
((System.Text.RegularExpressions.RegexOptions.Igno rePatternWhitespace
Or _
System.Text.RegularExpressions.RegexOptions.Single line) _
Or System.Text.RegularExpressions.RegexOptions.Ignore Case)
Dim reg As System.Text.RegularExpressions.Regex = New
System.Text.RegularExpressions.Regex(regex, options)
Dim objMatches As System.Text.RegularExpressions.MatchCollection
Dim objMatch As System.Text.RegularExpressions.Match
objMatches = System.Text.RegularExpressions.Regex.Matches("your text
here", regex)
For Each objMatch In objMatches
Debug.WriteLine(objMatch.Value)
objMatch = Nothing
Next
Another question: is this code using the class from my original post? Is
that auto-generated class usful at all or should I not be concerned with it?
Thanks again,
Chris
"Cesar Ronchese" <ronchese_hotmail_dot_com> wrote in message
news:eF*************@TK2MSFTNGP12.phx.gbl...
Dim regex As String =
"^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w ]*))+\.(txt|TXT)$"
Dim options As System.Text.RegularExpressions.RegexOptions
= ((System.Text.RegularExpressions.RegexOptions.Igno rePatternWhitespace Or
System.Text.RegularExpressions.RegexOptions.Multil ine) _
Or
System.Text.RegularExpressions.RegexOptions.Ignore Case)
Dim reg As System.Text.RegularExpressions.Regex = New
System.Text.RegularExpressions.Regex(regex, options)
Dim objMatches As
System.Text.RegularExpressions.MatchCollection
Dim objMatch As System.Text.RegularExpressions.Match
objMatches = reg.Matches("your text here", regex)
For Each objMatch In objMatches
Debug.WriteLine(objMatch.Value)
objMatch = Nothing
Next
[]s
Cesar
"Chris" <co***********@nospam.yahoo.com> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
How Do I use the following auto-generated code from The Regulator?
'------------------------------------------------------------------------------
' <autogenerated>
' This code was generated by a tool.
' Runtime Version: 1.1.4322.2032
'
' Changes to this file may cause incorrect behavior and will be lost
if
' the code is regenerated.
' </autogenerated>
'------------------------------------------------------------------------------
Option Strict Off
Option Explicit On
Namespace Regulator
Public Class RegularExpression
Private Sub Test()
Dim regex As String =
"^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w ]*))+\.(txt|TXT)$"
Dim options As System.Text.RegularExpressions.RegexOptions =
((System.Text.RegularExpressions.RegexOptions.Igno rePatternWhitespace Or
System.Text.RegularExpressions.RegexOptions.Multil ine) _
Or
System.Text.RegularExpressions.RegexOptions.Ignore Case)
Dim reg As System.Text.RegularExpressions.Regex = New
System.Text.RegularExpressions.Regex(regex, options)
End Sub
End Class
End Namespace
I've placed this code in it's own file by clicking on Project-->Add
New-->Class.
Then from inside another one of my project files I...
Dim MyVariable As New Regulator.RegularExpression
Now what do I have to do to use this expression?
Any help would be greatly appreciated.
Thanks,
Chris