question

GregM avatar image
GregM asked GregM posted

[TIP] Skipping lines in a pattern

Pattern response mapping is very powerful, but can be tricky where there is variability or optional content possible in a response.  The attached response map illustrates how multiple variable lines in a response can be ignored.

 

Given a response such as:

 

pattern of interest: 987
tagA - start of stuff to ignore
ignore line
more ignore line
tagB - end of stuff to ignore
more pattern of interest: xyz

If only the first and last lines are of interest, the lines tagA through tagB can be skipped using the following anchor.

 

\s+tagA(.*[\n\r]+)+tagB[^\n\r]+\s+

 Where (.*[\n\r]+)+ represent the lines to be skipped.  The [^\n\r]+ is used to skip the text trailing tagB.

 

iTestresponse map
10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
hariramakrishna avatar image
hariramakrishna answered hariramakrishna posted

Thanks Greg for sharing this valuable information. This is very much help full.

 

Its easy to have a token or line skipping property just like optional property in Block mapping just by right clicking in editor.

10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.