Simple Regex Request -- TIME



  • Hi

    I have a recurring log that needs to be edited regularly to subtract the time element. I will post an example of the log:

    [18:16:16] John A: Done. That did not take long.
    [18:16:50] Michelle Z: “Any questions so far?”

    What i want:

    John A: Done. That did not take long.
    Michelle Z: “Any questions so far?”

    I attempted to learn the process of creating a Regex but it is all so complicated for me. I did look over several tutorials.
    There is no space before the open bracket on each line and there should not be a space before the name when edited.

    Thank you VERY much for the help!



  • Use ^[\d{2}:\d{2}:\d{2}]\s for searching. Replace with empty string.



  • Thank you, thank you, thank you! Not only does it work well but I learned from this and used what I learned already! Your Regex left a space at the beginning of each line because you did not perceive there was an additional space there. I added a \s at the end of it and that got rid of that extra space.

    This was very valuable to me.



  • Ah, yes, I assumed a fixed single-space Gap. And to match an arbitrary-length sequence of spaces, try \s+ instead of \s\s.


Log in to reply