Reputation: 3
I'm trying to use the Regular Expression Extractor in JMeter. When I try to parse the following string:
8EC4146730CC4A27afMCCam3ZeAl4uWt3qMMi9cE7Q5YtIkS5BDaba6bI1cgv41dm07wWlFjAmCcRLd97tmLyuO0ycKflQzhaoQS68CGaRo1oqsL1ZQyLGJMM
From the html snippet:
<a href="siw_portal.url8EC4146730CC4A27afMCCam3ZeAl4uWt3qMMi9cE7Q5YtIkS5BDaba6bI1cgv41dm07wWlFjAmCcRLd97tm-LyuO0ycKflQzhaoQS68CGaRo1oqsL1ZQyLGJMM" id="STU_COURSE" title="Your course">YourCourse</a>
</dt>
Using this Regular Expression:
<a href='siw_portal.url\?([^"]+)' id="STU_COURSE" title='Your course'>Your Course</a>
</dt>
And Template is set to $1$.
The Regular Expression Extractor doesn't find the string.
Any ideas on why this isn't working, or how to debug this will be much appreciated.
Thanks
Upvotes: 0
Views: 173
Reputation: 61
This should work
<a href="siw_portal.url(.+?)" id="STU_COURSE" title="Your course">YourCourse<\/a>
<\/dt>
Upvotes: 0
Reputation: 1452
You can test your regex using any online regex tester, which will help you with simple syntax errors, and also provide hints which cn be really useful for a beginner.
I like this one: http://regex101.com/
You have used different quotation marks in your regex to the sample you are matching, which is why you don't find a match. You are matching "
when the sample uses '
.
You can make it work in both cases using ["']
or choose the correct '
or "
In your sample, try:
<a href=["']siw_portal\.url([^"^']+)["'] id=["']STU_COURSE["'] title=["']Your course["']>Your Course</a>
</dt>
Upvotes: 1
Reputation: 91518
Because you made a mistake with the quotes:
<a href="siw_portal.url\?([^"]+)".......title="Your course"
// __^ __^ __^ __^
instead of
<a href='siw_portal.url\?([^"]+)'.......title='Your course'
Upvotes: 1