Knapp zu spät...

Als Alternative zu Regex noch dieser Ansatz
Code: Alles auswählen
// https://community.openhab.org/t/solved-help-on-regex/103231/5
// https://community.openhab.org/t/solved-regex-transformation/68359/3
// OpenHAB Regex ist nicht Standard Regex und kann nicht mit freien Validatoren verglichen werden
rule "OpenHab Uptime"
when
Item currentDateTime changed
then
// use the transformation service to retrieve the value
val BefehlOutputOpenHabUptime = "BefehlOutput changed from A systemd service configuration exists...Use 'sudo /bin/systemctl status openhab2.service' to find the status of an openHAB serviceopenHAB is running with PID: 2066 and has been running for 80-06:57:25 to A systemd service configuration exists...Use 'sudo /bin/systemctl status openhab2.service' to find the status of an openHAB service openHAB is running with PID: 2066 and has been running for 80-06:58:25"
// Suche nach 'running for' ohne Regex
var newValue = BefehlOutputOpenHabUptime.split('running for ').get(1).trim
newValue = newValue.substring(0,11)
// log das Ergebnis
logInfo('OpenHab Uptime String:',newValue)
end
Code: Alles auswählen
80-06:57:25
Thomas