Transform Rule from OH2.5 to OH3 Rule

Hi together,
I try to migrate my OH2.5 to OH3.1

My rule in OH2.5

 rule "Strom Hex String "
                 Time cron "0/30 * * * * ?" or //jede 30 Sekunden
                 System started
         var String StrZStand = Zaehler1.state.toString
         var Number StrZStandStart = StrZStand.countMatches("1b1b1b1b0101010176") // Kontrolle ob Startsequenz vorhanden
       if (StrZStandStart<1){ //keine Startsequenz in String
         else if (StrZStandStart>=1){ //mindestens 1x Startsequenz vorhanden
                 var String zwi1 = StrZStand.substringAfter("0100010801ff")      // String Zählerstand nach 0100010801ff
                 var String zwi2 = zwi1.substringBefore("017707")                //String Zählerstand vor 017707
                 var Number Standlaenge =  zwi2.length()
                 if (Standlaenge==26){
                         var String StrHexStand = zwi2.substring(16,26)                          //String in Hex Format
                         val Stand =  Integer.parseInt(StrHexStand, 16) as Number                //Stand Zähler
                         var Number Standkwh=Stand*0.0001

In OH2.5 its fine but in OH3

Is the Syntax wrong?

THX Jens

In OH3 … what? What unexpected results do you get? What does your openhab.log say?

See -