How to strip all after . with regular expression

I get the following saved to a variable called Timestamp...

2246.030539

I want to search for all the data coming after the period sign, and remove so the Timestamp variable would then contain...

2246

There are many ways how you can do this with a regex. Just one example:

30-pty-fs8
[demo] Modifiy Timestamp (regex).kmmacros (3.0 KB)

This deletes the first dot and everything after that.


But in this case (often the number of fraction digits is constant in a time stamp) you probably don’t need a regex and can just use a Substring action:

43-pty-fs8
[demo] Modifiy Timestamp (substring).kmmacros (3.0 KB)


Another way would be to format the timestamp accordingly (no fractions) right from the start – unless you need the fraction digits for some other action, of course.

4 Likes