RE: How to split a string between <> or "" in VB.net
- From: "Mark" <Mark@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 30 Aug 2005 14:22:03 -0700
Check out
http://www.dotnetcoders.com/web/Learning/Regex/RegexTester.aspx
Enter "(.*)"\s+<(.*)> in the regular expression box
Enter "John Doe" <john.doe@xxxxxxxxxxxxx> in the test string box
Click on the Groups button
You can simulate this test in .net by adding a form with 2 text boxes. One
for the regular expression pattern and the other for the test string. Sample
code below
Dim r As Regex = New Regex(txtRegEx.Text, iOptions)
' Match the regular expression pattern against a text string.
Dim m As Match = r.Match(txtTestString.Text)
Dim matchcount As Integer = 0
While (m.Success)
matchcount += 1
sResults = "Match" & (matchcount) & " '" & m.ToString &
"'" & Chr(10)
Dim i As Integer
For i = 0 To m.Groups.Count - 1
sResults = sResults & " Group " & i & "='" &
m.Groups.Item(i).ToString & "'" & Chr(10)
Next i
m = m.NextMatch()
End While
"michael.bollhoefer@xxxxxxxxxx" wrote:
> I am trying to split a string into two different variables. The string
> is pulled from an XML file from a WEBDAV program. The string will be
> in this form
> "John Doe" <john.doe@xxxxxxxxxxxxx>
>
> the qoutes and <> are actually part of whole strinng. I need to be
> able to split the name into one variable and the e-mail address into
> another. I have been playing around with the .split but have not had
> much luck. Any suggestions?
>
>
.
- References:
- How to split a string between <> or "" in VB.net
- From: michael . bollhoefer
- How to split a string between <> or "" in VB.net
- Prev by Date: Re: Drive type
- Next by Date: FaxOutgoingJob.AvailableOperations: how to interpret it
- Previous by thread: Re: How to split a string between <> or "" in VB.net
- Next by thread: RE: Print Pdf doesn't work
- Index(es):