0

Please help me with building regular expression for the below response sequence

I have defined a variable PlanName = prod-p1 in testplan.

Response:

projectmanagement.plan.Plan%3A2992173879&amp;u8=1\" ext:qtip=\"prod-p1\">prod-p1<\/a> 

Regular Expression build is:

ptc.projectmanagement.plan.Plan\%3A([^"]+)&amp\;u8=1\\" ext:qtip\=\\"${PlanName}\\">${PlanName}\<\\

Currently I am getting below error in Jmeter

jmeter.extractor.RegexExtractor: Error in pattern: ptc.projectmanagement.plan.Plan\%3A(.+?)\&amp\;u8=1\" ext:qtip\=\"prod-p1\">prod-p1\<\
Wiktor Stribiżew
  • 607,720
  • 39
  • 448
  • 563

3 Answers3

0

You need to escape \ symbols with another backslash so amend your regular expression to look like:

projectmanagement.plan.Plan%3(.+?)&u8=1\\" ext:qtip=\\"prod-p1\\">prod-p1</a>

Demo:

JMeter Regex Demo

References:

Dmitri T
  • 159,985
  • 5
  • 83
  • 133
  • Apologies for the trouble. The RegEX that was posted by me is working. Actually issue is arising when i am trying to replace prod-p1 with a variable name that is defined at test plan. So RegEx is ptc.projectmanagement.plan.Plan\%3A([^"]+)&amp\;u8=1\\" ext:qtip\=\\"${PlanName}\\">${PlanName}\<\\ I have defined PlanName in testplan as prod-p1 Variable is getting replaces in regular expresion but i am getting below error jmeter.extractor.RegexExtractor: Error in pattern: ptc.projectmanagement.plan.Plan\%3A(.+?)\&amp\;u8=1\" ext:qtip\=\"prod-p1\">prod-p1\<\ – SURAJ SHARMA May 16 '18 at 09:11
  • Please refer updated question. Thanks and apologies once again – SURAJ SHARMA May 16 '18 at 09:18
0

Check the below regular expression and output:-

projectmanagement.plan.Plan%3A(.+?)&u8=1\\" ext:qtip=\\"prod-p1\\">prod-p1</a>

enter image description here

Hope it helps.

Community
  • 1
  • 1
sunny_teo
  • 1,961
  • 1
  • 7
  • 11
0

@Suraj

Use the following Regular Expression

projectmanagement\.plan\.Plan%3A(.+?)&u8=1\\" ext

In your response there are . and \ tokens , To match those characters append a backslash () so that JMeter matches the character . or \ literally.

enter image description here

For more information

JMeter Regular Expressions

Extracting Variables in Jmeter

You can use this website to test your regular expressions

Rohit
  • 601
  • 4
  • 12