Community Patterns

Community Library Entry

0

Regular Expression
Created·2022-11-26 18:23
Updated·2022-11-26 21:13
Flavor·Java

"
(?:\"(?:errorType)\"(?:[^:])*):(?:(?:[^\",])*)\"([^\"]*)
"
g
Open regex in editor

Description

Sample:

Finds errorType key values from a json. Values are returned in capturing group 1 of each match. Both UNKNOWN and UNAUTHENTICATED will be captured.

 {
  "data": null,
  "errors": [
    {
      "message": "Message",
      "extensions": {
        "errorType": "UNKNOWN",
        "error_code": "AUTHENTICATE_USER_FALSE"
      }
    },
    {
      "message": "Message",
      "extensions": {
        "errorType": "UNAUTHENTICATED",
        "error_code": "AUTHENTICATE_USER_FALSE"
      }
    }
  ]
}
Submitted by amansaryal