Search key in body and tranform it

Hi i try to test a moolde quinz, so i have correctly login but when create a attempt quiz i must transmit sesskey. This key is not in session but in body.

i try this

exec(http(“Go to quiz”)

.post("/quizex/mod/quiz/view.php")

.param(“id”,“67”)

.check(regex(""“sesskey=\w*”"").find(0) #### This find correctly sesskey but in this format sesskey=jhsfdkjbsdkjf

//.transform(“tras”)

.saveAs(“sesskey”))

.headers(headers_3)

)

.pause(7, 8)

.exec(

with check i find correctly sessly and save it but in this format “sesskey=jhsfdkjbsdkjf”

I want split it and save only value but transform in not documentation so i want a suggesiton

Can you help Me?

You have to use a capture group. See javadoc: http://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html

You probably want something like sesskey=(\w*)

Note that you don’t need find(0) as it’s the default.

I try solution with this :smiley:

.check(regex(""“sesskey=\w*”"").find(0)

.transform(string => string.map{_.split("=")(1)})

.saveAs(“sesskey”))

Thank to me :smiley:

Still, using a capture group would be much cleaner…