user1813000
user1813000

Reputation: 121

Regular Expression Extractor in Jmeter

I have this response in HTTP request as below

href="index.php?module=Meetings&action=DetailView&record=ed51c2d9-1958-bd61-cce1-509d30ccd4ac">

I want to get the value of "record", but when I set

Regular Expression : record=(.+?)

only "e" is returned. What do I need to do instead?

Upvotes: 5

Views: 1022

Answers (2)

Subash Bose
Subash Bose

Reputation: 71

The given text

href="index.php?module=Meetings&action=DetailView&record=ed51c2d9-1958-bd61-cce1-509d30ccd4ac">

Regular Expression to get the record values from the given text values

record=(.+)"

Regular Expression gets the following record values

record=ed51c2d9-1958-bd61-cce1-509d30ccd4ac"

Upvotes: 0

Martin Ender
Martin Ender

Reputation: 44259

Well the regular expression consumes as little as possible (due to the ?). Hence, it is satisfied after taking in the first character. You should probably rather make it greedy and restrict the possible characters (so that it cannot go past the end of the parameter):

record=([a-f0-9-]+)

If you do not know which characters are allowed as the parameter's value, you could also say, consume everything but ampersands and quotes:

record=([^"'&]+)

Depending on where you use it, you might need to escape one of the quotes with a backslash.

Upvotes: 6

Related Questions