Cómo obtener la palabra particular de la respuesta en el extractor de expresiones regulares jmeter

I am trying to extract the last value from the string in Jmeter Regular Expression extractor.

Mi cuerda

Server.init("asdfasd4ffffasdf", "http://x.x.x.x:8888/", "asdf-U-Yasdf77asdf99");

Solo quiero conseguir asdf-U-Yasdf77asdf99.

I tried something like the below, but not correct:

Server.init\(".+", ".+", "([A-Za-z0-9\-]+)"\);

preguntado el 27 de noviembre de 13 a las 05:11

What do you mean by saying that your regex is "not correct"? How are you using it and what results you get? -

3 Respuestas

Usar JMeter you need to reference your match group.

Reference Name: MYWORD
Regular Expression: Server\.init\("[^"]+", "[^"]+", "([^"]+)"\);
Template: $1$

Your captured match can be accessed by using ${MYWORD}

If you specify using a Match No: above, use the corresponding value to access the match.

respondido 27 nov., 13:06

Awesome. It would work, but I changed little bit from your solution. Server.init(".+?", ".+?", "(.+?)"); - compañero mohamed

That regex, while not very beautiful, should work when used correctly. But you need to look at the result of group 1, not the entire match.

So you need to do something like

Pattern regex = Pattern.compile("Server\\.init\\(\"[^\"]+\", \"[^\"]+\", \"([A-Za-z0-9\\-]+)\"\\);");
Matcher regexMatcher = regex.matcher(subjectString);
if (regexMatcher.find()) {
    ResultString = regexMatcher.group(1);

respondido 27 nov., 13:06

Expresión regular:


Matches the following string

Server.init("asdfasd4ffffasdf", "http://x.x.x.x:8888/", "asdf-U-Yasdf77asdf99"

we can extract the following values in jmeter:

  • $1 valores = asdfasd4ffffasdf
  • $2 valores = http://x.x.x.x:8888/
  • $3 valores = asdf-U-Yasdf77asdf99

respondido 27 nov., 14:12

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.