0

enter image description hereusing regular expression [![ from responsedata we need to extract testqa1 and testsampleqa1]3

i want values if i put ${testqa 1}and${ testsampleqa1 } and so on how to do that can u pls help me forthis issue

2 Answers 2

2

In the regular expression field use this data:

a href = "test.(.*?).com/(.*?)/(.*?)"

In Template field, add $2$$3$

Leave the default value field blank.

To pass the extracted testqa1, use ${TestValues_g2}, to extract testsampleqa1, use ${TestValues_g3} where you want to pass them. If you want to combine the extracted value and pass it, then use ${TestValues1_g2}${TestValues1_g3} together, without space.

To capture all the values, use three regular expression extractor. In each one, use a different variable for storing the value eg. TestValues1, TestValues2, TestValues3. So, for extracting value from test.gmail.com, enter 1 in match no. column in 1st regular expression. For extracting value from test.bing.com, enter 2 in match no. column in 2nd regular expression and so on.

4
  • use ${TestValues_g1},${TestValues_g2} these two values where can i add ? means in regular expression ??
    – Guruganesh
    Jun 8, 2018 at 6:27
  • I need to capture all the values after the slash from the below url. a href = "test.gmail.com/testqa1/testsampleqa1" a href = "test.bing.com/testqa2/testsampleqa2" a href = "test.yahoo.com/testqa3/testsampleqa3" For above activity please use "Dummey Sampler" , after the extract the values i need to pass captured values with single variable as shown below. i.e test.gmail.com/${extractvariable} this my requirement can u pls suggest me
    – Guruganesh
    Jun 8, 2018 at 6:32
  • @Guruganesh Use these ${TestValues_g2} where you want to enter the extracted value. I have edited the answer, according to your doubts, kindly read it from the beginning..
    – Rishikesh
    Jun 8, 2018 at 7:15
  • tq so much rishikesh
    – Guruganesh
    Jun 8, 2018 at 7:32
0

IF you want to extract all the values after the slash use the following regular expression

"test.(.+?).com\/(.+?)"

in the template field use $1$2$ as we have 2 matching groups one for each matching group

If you want to extract all values you can use -1 Match no as shown below.

and Name your regular expression extractor as TestValues as shown below

enter image description here

Above expression will extract all 3 values and stores the values in

TestValue_1_g1 TestValue_1_g2
TestValue_2_g1 TestValue_2_g2
TestValue_3_g1 TestValue_3_g2

Group 1 stores the domain name and Group 2 stores the value after slash

as shown below

enter image description here

use variables

    ${TestValue_1_g1} ${TestValue_1_g2}
    ${TestValue_2_g1} ${TestValue_2_g2}
    ${TestValue_3_g1} ${TestValue_3_g2}

where you want to replace the values eg : to pass extracted variables

test.${TestValue_1_g1}.com/${TestValue_1_g2}

IF you want to extract a random value from 3 values you can use 0 instaead of -1 match number in regular expression extractor

and use ${TestValue_g1} ${TestValue_g2} to replace, so you can use the following

test.${TestValue_g1}.com/${TestValue_g2}

Use this website for testing your regular expression For more information on regular expression extractors read this article

Please let me know if it helps..

1
  • tq so much rohit
    – Guruganesh
    Jun 11, 2018 at 8:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.