Follow

Parsing HTML and Plain Text Response Bodies Using "Capture"

« Previously: Response Parsing Overview

For plain text or HTML responses (but not XML or JSON), string values can be extracted into appended data by mapping regular expressions to "capture" variables.

For example, with a response like:

plaintextresponse.JPG

and this mapping in the outbound step:

capturemappingsample1.JPG

The value from the regular expression's match group will be appended to the lead data:

captureexample1.JPG

Note: The formulation of expression can be tricky, especially for long or multi-line responses. Mapped regular expression values are lowercased, so take that into consideration, or use syntax like /.../i.

Line-separators in the response may not match anchors (^ & $) as expected, so the "multiline" modifier may be needed (/.../m).

Another example, which will result in title being set with "The Raven":

Response:

plaintextresponse2.JPG

Mapping:

capturemappingsample2.JPG

Result:

captureexample2.JPG

Mapping captured parameters into rules or outbound steps.

Parameters that have been appended using "Capture" don't show up in the field dropdown as do other appended parameters. Here's how to map them:

Parsing Json Response Bodies Using Dot Notation

Parsing HTML Response Bodies Using CSS Selectors

Parsing XML Response Bodies Using XPath

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

You must be logged in to comment.