Ama*_* Ts 2 regex go re2
我试图将下面的字符串与正则表达式匹配,并从中获取一些值.
/system1/sensor37
Targets
Properties
DeviceID=37-Fuse
ElementName=Power Supply
OperationalStatus=Ok
RateUnits=Celsius
CurrentReading=49
SensorType=Temperature
HealthState=Ok
oemhp_CautionValue=100
oemhp_CriticalValue=Not Applicable
使用下面的正则表达式
`/system1/sensor\d\d\n.*\n.*\n\s*DeviceID=(?P<sensor>.*)\n.*\n.*\n.*\n\s*CurrentReading=(?P<reading>\d*)\n\s*SensorType=Temperature\n\s*HealthState=(?P<health>.*)\n`
/system.sensor\d\d.*DeviceID=(?P.*)\n*.