JMETER - Regular Expression Extractor (regex)

Asked

Viewed 595 times

-2

  • Although it is possible to do with regex, I do not think it is the best way (regex is cool, but it is not always the best solution). My suggestion is that you use the class java.net.URL, that represents a URL (just what its String is): https://docs.oracle.com/javase/8/docs/api/java/net/URL.html

  • Thank you so much for the return! I will check and understand. However, you would know about regex in this situation?

  • I believe that a google search for "regex URL" should bring several options - and maybe right here on this site should have some related question (sorry, I did not search, but there should be pq is not a new subject and someone already asked). But these regex are usually so complicated that I find it simpler to use the class URL even :)

1 answer

2


Add a Regular expression extractor

use the following setting in your regular expression extractor.

Field to Check : URL

Name of Created Variable : Value

Regular Expression : (.+?):\/\/(.+?)\/(.+?)\?X-Amz

Template : $1$2$3$

Match no:  1

inserir a descrição da imagem aqui

This will Extract all 3 required values on a single go and Saves These values in variables Value_g1, Value_g2, Value_g3

inserir a descrição da imagem aqui

You can use $ {Value_g1} / $ {Value_g2 / Value_g3} to replace values

More Information

Extractors of regular expression

  • Thank you so much for the explanation, @Rohit. .

Browser other questions tagged

You are not signed in. Login or sign up in order to post.