如何根据键正则表达式查找值
How to find value based on key Regex
我想使用正则表达式提取基于键的值,但找不到表达式。
我在互联网和 Whosebug 上尝试了很多可用的表达式,但没有任何效果。
这是我想做的一个例子-
给定的字符串-
{"summaryId":"x436a218-61703d00-15180-6","calendarDate":"2021-10-21","activityType":"WALKING","activeKilocalories":119,"bmrKilocalories":2283,"steps":3972,"distanceInMeters":2919.0,"durationInSeconds":86400,"activeTimeInSeconds":2786,"startTimeInSeconds":1634745600,"startTimeOffsetInSeconds":28800,"moderateIntensityDurationInSeconds":0,"vigorousIntensityDurationInSeconds":0,"stepsGoal":7500,"intensityDurationGoalInSeconds":9000,"floorsClimbedGoal":10}
我想提取“steps”键的值,即 3972(对于此示例)
您可以在这里使用回顾:
(?<="steps":)[^,]+
这里 demo 显示正则表达式正在运行。
我想使用正则表达式提取基于键的值,但找不到表达式。
我在互联网和 Whosebug 上尝试了很多可用的表达式,但没有任何效果。 这是我想做的一个例子-
给定的字符串-
{"summaryId":"x436a218-61703d00-15180-6","calendarDate":"2021-10-21","activityType":"WALKING","activeKilocalories":119,"bmrKilocalories":2283,"steps":3972,"distanceInMeters":2919.0,"durationInSeconds":86400,"activeTimeInSeconds":2786,"startTimeInSeconds":1634745600,"startTimeOffsetInSeconds":28800,"moderateIntensityDurationInSeconds":0,"vigorousIntensityDurationInSeconds":0,"stepsGoal":7500,"intensityDurationGoalInSeconds":9000,"floorsClimbedGoal":10}
我想提取“steps”键的值,即 3972(对于此示例)
您可以在这里使用回顾:
(?<="steps":)[^,]+
这里 demo 显示正则表达式正在运行。