10-11-2023 06:32 AM
Hi, is there a way to replace characters using a wildcard with a blank ?
There are always 6 zeroes, and random 3 digits and a period before the 6 zeroes
2023-10-09 17:38:36.243000000 More text here
2023-10-09 17:42:37.770000000 More text here
Becomes
2023-10-09 17:38:36 More text here
2023-10-09 17:42:37 More text here
Solved! Go to Solution.
10-11-2023 08:46 AM
Hi, me again. You can use gsub with a regular expression (regex).
The below regex looks for a period followed by any quantity of numbers and removes them.
[message].gsub(/[.][0-9]+/,"")
Example: "2023-10-09 17:38:36.243000000" becomes "2023-09 17:38:36"
There are a million regex sites out there but I find this one particularly helpful: https://regexr.com/
10-11-2023 08:46 AM
Hi, me again. You can use gsub with a regular expression (regex).
The below regex looks for a period followed by any quantity of numbers and removes them.
[message].gsub(/[.][0-9]+/,"")
Example: "2023-10-09 17:38:36.243000000" becomes "2023-09 17:38:36"
There are a million regex sites out there but I find this one particularly helpful: https://regexr.com/
10-11-2023 09:59 AM
Thanks. I will add that to my "Tips & Tricks" document I am making for myself.