Beginner need some help on REGEX
My items are named as RoomName+"_ " + Item name. Eg:
Janka_CurrTemp (g_CurrTemp)
Janka_TempSetpoint (g_TempSetpoint)
When I try to trigger a rule if CurrTemp of any room changes it is working well and I can write out the name of triggering room to v_szoba:
when
Member of g_CurrTemp changed
then
val v_szoba = transform(“REGEX”, “(.*?)_CurrTemp”, triggeringItem.name)
logInfo( “Teszt2”, v_szoba + " " + triggeringItem.name)
2020-11-01 14:53:38.508 [INFO ] [clipse.smarthome.model.script.Teszt2] - Janka Janka_CurrTemp
But if I would trigger the same rule by changes of more items so I remove the item “post fix” (eg CurrTemp) from the REGEX it come back with Null value in the v_szoba.
when
Member of g_CurrTemp changed or
Member of g_TempSetpoint changed
then
val v_szoba = transform(“REGEX”, “(.*?)_”, triggeringItem.name)
logInfo( “Teszt2”, v_szoba + " " + triggeringItem.name)
2020-11-01 14:53:38.582 [INFO ] [clipse.smarthome.model.script.Teszt2] - null Janka_CurrTemp
If I check it on Regex101 the result should be the same:
searching for “CurrTemp":
searching for "” only:
Thanks for any hint