First 3 octets of subnet?

How would I get just the first 3 octets of a subnet?

For example: 192.168.1.0 I want just the 192.168.1. part.

(preceding text of last "." of it | it) of (it as string as trimmed string) of "192.168.1.0"

Or for multiple:

(preceding text of last "." of it | it) of (it as string as trimmed string) of ("192.168.1.0";"192.168.2.0";"172.168.1.0")