How can I extract a block of text between 2 strings

shurb

Member
Joined
Oct 9, 2007
Messages
16
Programming Experience
1-3
I have a block of text in a file:

It is displaying as one string but the file really is set as this format:
Charges:
784.03-2560 BATTERY-TOUCH OR STRIKE
Original Bond: $0.00Current Bond: $0.00
* DOMESTIC
Original Bond: $0.00Current Bond: $0.00

Name:


I want to extract what is between Charges: and Name: to end up with just
784.03-2560 BATTERY-TOUCH OR STRIKE Original Bond: $0.00Current Bond: $0.00 * DOMESTIC Original Bond: $0.00Current Bond: $0.00 returned.

Seems simple but for some reason I cannot do it.
I tried the regex option but I think I am barking up the wrong tree.
Any help on how to achieve this is much appreciated.
 
VB.NET:
MyStr.Substring(InStr(MyStr, "Charges:"), InStr(MyStr, "Name:") - InStr(MyStr, "Charges:"))

you might need to write a +1 or -1 in some of those terms... you'll see when u test it.
 
Back
Top