REGEX expression in rule with negative number?

I have a rule extracting various values from a text output of an EXEC-binding command.

	val aduroh2_opdata_milli_ampere_newValue = transform("REGEX", ".*operating_data/milli_ampere=(\\d*)\n.*", aduroh2_opdata_Output_str.state.toString)

My problem is, that when the value which is picked up is negative (i.e. “-15”) the result is “null”. What should my regex expression look like to take negative numbers into account, as well as the normal (positive) numbers which it works with now ?

Try:

(-?\\d*)

Questionmark behind the dash symbol means that there appears one or no dash symbol.

Seems to work. Thanks ! - I always struggle with REGEX expressions in OH - expecially when no example is available…

Now we have one :wink: