fork(1) download
  1. Imports System
  2. Imports System.Text.RegularExpressions
  3.  
  4. Public Class Test
  5. Public Shared Sub Main()
  6. Console.WriteLine(ReplaceTime("[06:34:22] Hello there!"))
  7. Console.WriteLine(ReplaceTime("[22:47] Hi!"))
  8. End Sub
  9.  
  10. Public Shared Function ReplaceTime(ByVal Input As String) As String
  11. Dim m As Match = Regex.Match(Input, "(\[)(\d{1,2}\:\d{1,2}(\:\d{1,2})?)(\])(.+)")
  12. Return m.Groups(1).Value & m.Groups(4).Value & m.Groups(5).Value
  13. End Function
  14.  
  15. End Class
Success #stdin #stdout 0.07s 24536KB
stdin
Standard input is empty
stdout
[] Hello there!
[] Hi!