I'm not quit sure what you mean but try this out and see if this is what you
want. This will only work if you have vbCrLf between your string items. Play
around with it.
Dim str As String = "A1 asdf asdf 1 324 25" & vbCrLf _
& "B1 af 234 wt sdgf 5w4" & vbCrLf _
& "C1 4q43g s 5 w343 4 4343" & vbCrLf _
& "D1 24 gw 3 43 gt 4334 34 3dgf" & vbCrLf _
& "E1 asfq2543 4 3t4 34434q3" & vbCrLf _
& "F1 asdf233 q44t43rgg34 34" & vbCrLf _
& "G1 aqt43rfd4343gfdf43 234+"
Dim reg As New Regex("(?<Item>[B-F]1( |\w*)*)")
Dim mtch As Match
For Each mtch In reg.Matches(str)
Debug.WriteLine(mtch.Groups("Item").ToString)
Next
"Claud Balls" <Li**@trainer.com> wrote in message
news:Oj**************@TK2MSFTNGP14.phx.gbl...
Will Regex allow me to pull a chunk of data from between two variables?
For example, I read the following into a variable
A1 asdf asdf 1 324 25
B1 af 234 wt sdgf 5w4
C1 4q43g s 5 w343 4 4343
D1 24 gw 3 43 gt 4334 34 3dgf
E1 asfq2543 4 3t4 34434q3
F1 asdf233 q44t43rgg34 34
G1 aqt43rfd4343gfdf43 234
Is there a way to split or match so I only get this:
B1 af 234 wt sdgf 5w4
C1 4q43g s 5 w343 4 4343
D1 24 gw 3 43 gt 4334 34 3dgf
E1 asfq2543 4 3t4 34434q3
F1 asdf233 q44t43rgg34 34
by feeding a regular expression the B1 and F1 variables?
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!