Help with parsing data

I have a python script that runs from the commandline outputs data in below format:

[Property(name=meter1_currentL2, value=0, id=2221_B, cat=meter1)>,
<AlfenProperty(name=meter1_currentL3, value=0, id=2221_C, cat=meter1)>,
<AlfenProperty(name=meter1_currentSum, value=0, id=2221_D, cat=meter1)>]

I would like to (manually) define items with the name equal to the name= parameter
Who can assist is parsing the output so that the correct value= gets assigned to this corresponding item? I assume a script or transformation rule would be recommended.
I have no ECMA script or Python semantics experience to write scripts myself but canb read and understand code

The python script generating the output has been created by Nick Douma (Alfeneve) for which I am very grateful.
If some feels interest to develop an Alfen EV binding for this you find the python code on his repo.

How are you getting this data into OH? executeCommandLine? Exec binding? REST API?

That can change the answer.

Unfortunately the data is in a really weird format. Is that an exact copy and paste from the output or did you type it in. According to the readme on the script’s site it should look like:

[<AlfenProperty(name=OD_manufacturerDeviceName, value=NG910, id=1008_0, cat=generic)>,
 <AlfenProperty(name=OD_manufacturerHardwareVersion, value=G0, id=1009_0, cat=generic)>,
 <AlfenProperty(name=OD_manufacturerSoftwareVersion, value=4.8.0-3168, id=100A_0, cat=generic)>,
 ... ]

which is much more reasonable and regular. Even then it doesn’t conform to any standard text encoding I’m familiar with so you’ll have to use string manipulation to extract the values. Regualr expressions are usually used for something like this but you should be able to use String split calls in a Rules DSL rule to extract the data.

Something like:

val rawString = ??? // how ever you get the string into OH
val entries = rawString.split(">,") // should separate each entry
entries.forEach[entry |
    val parts = entry.split(", ")
    val name = parts.get(0).split("=").get(1)
    val value = parts.get(1).split("=").get(1)
    val id = parts.get(2).split("=").get(1)
    val cat = parts.get(3).split("=").get(1)

    postUpdate(name, value) // posts the value to an Item matching the name in the entry
]

I just typed in the above. It likely has typos.

Thanks, did indeed copy/paste
I am considering using an exec thing
Reading the python (I have zero to no python knowledge, it looks the code is constructing some api calls.
For a OH-programmer it might be fairly doable to make an Alfen binding I guess.
Now finding a volunteer. I am unfortunately no programmer.

Managed to do it with an exec thing with piping a grep parsing of the result for the needed data in the output. Works perfect