question

TLee avatar image
TLee Suspended asked Spirent_Admin edited

Multi-line parsing

Is there a way I can parse a multiple line value into one query?  For example:

 

Port Type:  1000SX-260-1590-

                  3487

 

In this case I want the value for the query Port_Type to be 1000SX-260-1590-3487.

 

 

iTestresponse mappattern 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

·
PaulD avatar image
PaulD answered PaulD posted

This is a tricky situation.  I'm attaching a response map that shows how to extract this using a pattern map.  The example shows two ways:

 

example1:  This is a pattern map that looks for "Port Type:" and then grabs the text on the remainder of the current line (after whitespace) and the stuff on the subsequent line.  (Pattern tokens using custom regex's can span line boundaries.)  This works, except that the resulting match contains the whitespace in the middle and newline, which you probably don't want.  You could, however post-process that using script to remove the whitespace and newline.

 

example2:  This is a pattern map that extracts the first and second portion separately, then uses a custom query to combine these two fragments into a single query called portType() that gets the final value with no whitespace.  In this case, note that it will not correspond to a "blue box" in the response view, because it is a custom query.  So if you want to add an analysis rule using this value, you'd need to use the corresponding match in the Queries view.

 

 


split_token.ffrm (2.6 KiB)
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.