Imports System.Collections.Generic
Dim input as String = "10.0.0.6:80/ImageSuite/Web/Worklist/DICOMViewer.aspx?patient_id=5049885&study_uid=201702060824&accession_number=20170206082802&token" + Environment.NewLine + _
"10.0.0.6:80/ImageSuite/Web/Worklist/DICOMViewer.aspx?patient_id=4409276&study_uid=201702060826&accession_number=20170206083002&token" + Environment.NewLine + _
"10.0.0.6:80/ImageSuite/Web/Worklist/DICOMViewer.aspx?patient_id=4402764&study_uid=201702060801&accession_number=20170206080416&token" + Environment.NewLine + _
"10.0.0.6:80/ImageSuite/Web/Worklist/DICOMViewer.aspx?patient_id=4402537&study_uid=201702060837&accession_number=20170206084025&token"
public function GetStream() as Stream
Dim ms as new MemoryStream()
Dim writer as new StreamWriter( ms )
ms.Seek(0, SeekOrigin.Begin)
public function GetAllLines(inputStream as Stream) as IEnumerable(Of String)
Dim stringList as new List(Of String)
Using reader as new StreamReader( inputStream )
while not reader.EndOfStream
stringList.Add( reader.ReadLine() )
dim results = from line in GetAllLines( GetStream() ) _
where not String.IsNullOrWhiteSpace(line) _
from field in line.Split("&") _
where field.StartsWith("accession_number=") _
select field.Split("=")(1)
for each result in results
Console.WriteLine(result)