How can I take a part of a string that extracts a get text whith REGEX

As shown in the image, I have a chain to which I want to remove the time and leave only the text, since when extracting the information from whatsapp web brings me the message and the time stuck, without spaces or breaks of line to divide the messages

The regular expression that I am using is the following:
System.Text.RegularExpressions.Regex.Match(mensaje,"(?<=no u).*").ToString

Where no u, from where I want to read
mensaje is the information that I extracted from get text

How can I extract the information from the mensaje and in turn delete the hours

Hi @Jorge_Luis_Sanchez,
I understand that the timestamp patterns that you want to get rid of is ether “1-2 digits:2-3 digits:2 digits” or “1-2 digits:1-2 digits”. Also, you have mentioned that you are getting the string “without spaces or breaks of line to divide the messages”, so I understand that the split between the second to last and the last line is accidental in the text mentioned above - so your real string will actually quote G9:35H9:35I9:35J9:35K9:35L9:35M9:35N9:35 with the last “35” following “N:9:” without a line break. In that case how about replacing the timestamps with e.g . a space? This can be done with System.Text.RegularExpressions.Regex.Replace(text,"([0-9]{1,2}[:][0-9]{2,3}[:][0-9]{2})|([0-9]{1,2}[:][0-9]{2})", " ") Please see the outcome I am getting below. Does this solve your problem?

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.