Guest User

Untitled

a guest
Jul 19th, 2018
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.70 KB | None | 0 0
  1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  2.  
  3. Dim streamf As New System.IO.StreamReader("C:UsersZan and PolDesktopMinecraftMinecraftbinReleaseconfig.txt")
  4. Dim derp As String = streamf.ReadToEnd
  5.  
  6. Dim r As New Regex("Mappath = .*")
  7.  
  8. Dim randomstring As String = "Mappath = willitwork.ini"
  9.  
  10. Dim mappath As MatchCollection = r.Matches(randomstring) ' When changed to derp doesn't work. Derp does work when you put it in a message box too. I tried .tostring.)
  11. Dim dherp(1) As String
  12.  
  13. For Each mappaths As Match In mappath
  14.  
  15. dherp = mappaths.ToString().Split("= ")
  16. MsgBox(dherp(1))
  17. Next
  18.  
  19. Imports System
  20. Imports System.Text
  21. Imports System.Text.RegularExpressions
  22. Imports System.IO
  23.  
  24. Public class example
  25. Public shared sub Main()
  26.  
  27. Dim sb As StringBuilder = new StringBuilder()
  28. sb.AppendLine( "leading junk" )
  29. sb.AppendLine( "Mappath = willitwork.ini" )
  30. sb.AppendLine( "Mappath = works.ini" )
  31. sb.AppendLine( "trailing junk" )
  32.  
  33. Dim ms As MemoryStream = New MemoryStream()
  34. ms.Write(System.Text.Encoding.UTF8.GetBytes(sb.ToString()), 0, sb.tostring().length)
  35. ms.Seek(0, SeekOrigin.Begin)
  36.  
  37. Dim streamf As StreamReader = New StreamReader(ms)
  38. Dim derp As String
  39. derp = streamf.ReadToEnd
  40.  
  41. Dim r As New Regex("Mappath = .*")
  42. Dim randomstring As String = sb.tostring()
  43.  
  44. Dim mappath As MatchCollection = r.Matches(derp)
  45. Dim dherp(1) As String
  46.  
  47. For Each mappaths As Match In mappath
  48. dherp = mappaths.ToString().Split("= ")
  49. Console.WriteLine(dherp(1))
  50. Next 
  51. End Sub
  52.  
  53. End class
Add Comment
Please, Sign In to add comment