fork download
  1. Imports System
  2. Imports System.Text.RegularExpressions
  3.  
  4. Public Class Test
  5. Public Shared Sub Main()
  6. Dim TestString As String = "[10:56:49] [Client thread/ERROR]: Item entity 26367127 has no item?!" & Environment.NewLine & _
  7. "[10:57:25] [Dbutant] misterflo13 : ils coute chere les enchent aura de feu et T2 du spawn??*" & Environment.NewLine & _
  8. "[10:57:35] [Amateur] firebow ?.SkyLegend.? : ouai 0" & Environment.NewLine & _
  9. "[10:57:38] [Novice] iPasteque : ils sont gratuit me" & Environment.NewLine & _
  10. "[10:57:41] [Novice] iPasteque : ils sont gratuit mec *" & Environment.NewLine & _
  11. "[10:57:46] [Dbutant] misterflo13 : on ma dit k'ils etait payent :o" & Environment.NewLine & _
  12. "[10:57:57] [Novice] iPasteque : on t'a mytho alors"
  13. Console.WriteLine(ReplaceTime("[06:34:22] Hello there!"))
  14. Console.WriteLine(ReplaceTime("[22:47] Hi!"))
  15. Console.WriteLine("-------------------------------------")
  16. Console.WriteLine(ReplaceTimeMultiline(TestString))
  17. End Sub
  18.  
  19. Public Shared Function ReplaceTime(ByVal Input As String) As String
  20. Dim m As Match = Regex.Match(Input, "(\[)(\d{1,2}\:\d{1,2}(\:\d{1,2})?)(\])(.+)")
  21. Return m.Groups(1).Value & m.Groups(4).Value & m.Groups(5).Value
  22. End Function
  23.  
  24. Public Shared Function ReplaceTimeMultiline(ByVal Input As String) As String
  25. Dim ReturnString As String
  26. Dim Parts() As String = Input.Split(Environment.NewLine)
  27. For x As Integer = 0 To Parts.Length - 1
  28. ReturnString &= ReplaceTime(Parts(x)) & If(x < (Parts.Length - 1), Environment.NewLine, "")
  29. Next
  30. Return ReturnString
  31. End Function
  32. End Class
Success #stdin #stdout 0.09s 24432KB
stdin
Standard input is empty
stdout
[] Hello there!
[] Hi!
-------------------------------------
[] [Client thread/ERROR]: Item entity 26367127 has no item?!
[]  [Dbutant] misterflo13 : ils coute chere les enchent aura de feu et T2 du spawn??*
[]  [Amateur] firebow ?.SkyLegend.?  : ouai 0
[]  [Novice] iPasteque : ils sont gratuit me
[]  [Novice] iPasteque : ils sont gratuit mec *
[]  [Dbutant] misterflo13 : on ma dit k'ils etait payent :o
[]  [Novice] iPasteque : on t'a mytho alors