Regular Expressions 101

Community Patterns

Strip the Headers from a response where JSON is present

0

Regular Expression
ECMAScript (JavaScript)

/
HTTP\/\d*.\d*\s.*\sCache-Control:\s.*\s[^\{.\}]*
/

Description

HTTP/1.0 404 Not Found Cache-Control: no-cache Content-Type: application/json

{"validation_message":'...'}

will return:

{"validation_message":'...'}

which can then be turned into a JSON object.

Submitted by John B. - 8 years ago