Correlation - Regular Expression Extractor

After the script is recorded on replay of the same script correlation problem will occur for most of the webapplications.

1] As we have recorded a script in Recording script post, now run the same script again. It should give you some error i.e. Correlation problem.
2] To resolve this problem we need to correlate the dynamic values sent by the server like EngineID and SessionID in this example.

3] To exactly locate the dynamic values see in the “response code” and “requests” in  the view results tree of the corresponding failing page.
4] Now Create a RegularExpressionExtractor before the failing “http request” i.e.(http://www.irctc.co.in/cgi-bin/bv60.dll/irctc/booking/planner.do)
5] The fields of RegularExpressionExtractor are filled as below:
                ReferenceName: Give variable name that should be given to the dynamic value i.e.,”sessionid”
               Capture the Dynamic value that is to be correlated along with its left and right boundaries.In this example the http request looks like this in the request part of the view results tree of the corresponding failing page.
 https://www.irctc.co.in/cgi-bin/bv60.dll/irctc/booking/planner.do?screen=fromlogin&BV_SessionID=@@@@0584060878.1322216046@@@@&BV_EngineID=cccgadfffemkmldcefecehidfgmdfjm.0

Dynamic Value: @@@@0584060878.1322216046@@@@
Left bound: BV_SessionID=
Right bound: &
We need to replace the dynamic value with a regular expression i.e.,(.+?) in this example.

RegularExpression: BV_SessionID=(.+?)&
Template :Enter $1$
Match No. : Enter 1
Make sure that URL is enabled as the dynamic values are captured from the url part of the request data.
Same procedure is repeated for EngineId also as we have EngineId and SessionId as dynamic values.

ReferenceName: engineid 
Regular Expression: BV_EngineID=(.+) 
Template: $1$ 
matchNo.: 1

6] Now find and search wherever this dynamic values are present and replace the values with the reference variable name.
Now run the script again and see the results in View Result Tree.
In this way we can resolve the problem of Correlation using Regular Expression Extractor in JMeter.