Posted by Anonymous on Sat 11 Oct 11:11
report abuse | download | new post
- Imports System.Text.RegularExpressions
- Module Module1
- Sub Main()
- Dim sr1 As New IO.StreamReader("input.txt")
- Dim strFile As String = sr1.ReadToEnd
- sr1.Close()
- Dim re1 As Regex = New Regex("\r\n-{30,}.*$", RegexOptions.Singleline)
- If re1.IsMatch(strFile) Then
- strFile = re1.Replace(strFile, "") 'remove the additional LT= sections if you want to ignore them
- End If
- Dim re2 As Regex = New Regex("(?<!/)(?<varname>[A-Z]+)/ *(?<varvalue>[\w ,-]+)(?= +[A-Z]+/|\r\n)|(?<varname>[A-Z#]+)= *(?<varvalue>[\w /-]+)(?= +[A-Z]+=|\r\n)")
- Dim mc As MatchCollection = re2.Matches(strFile)
- Dim mIdx As Integer = 0
- For Each m As Match In mc
- Console.WriteLine(">>>varname '" & m.Groups("varname").Value.Trim & "' contains '" & m.Groups("varvalue").Value.Trim & "'<<<")
- Next
- Console.WriteLine("Done.")
- End Sub
- End Module
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.