I am new to jmeter; I hope that I can describe my problem to you well enough.
I am trying to use regex to extract an ItemID attribute from an xml element. Which I then use in another request. This is the XML response I am trying to extract the ItemID from:
<?xml version="1.0" encoding="UTF-8"?>
<Promise >
<SuggestedOption>
<Option TotalShipments="1">
<PromiseLines TotalNumberOfRecords="1">
<PromiseLine ItemID="Col_001" >
<Assignments>
<Assignment InteractionNo="1" >
</Assignment>
</Assignments>
</PromiseLine>
</PromiseLines>
</Option>
</SuggestedOption>
</Promise>
I have the Regular Expression Extractor set up as follows:
Reference Name: item
Regular Expression: .?ItemID=(.+?)*
Template: $1$
Match No.: 1
In the 2nd request I have set the ItemID as follows … ItemID=${item} …
I know that When I use the Default Value set to “Col_001” it works fine. So there is obviously a problem with my Expression.
Try this expression:
Explanation