Home > Mobile >  Jmeter remove brackets from results with regex
Jmeter remove brackets from results with regex

Time:08-31

I have tis jdcb call results

[{string_agg=1268#jm_eo_2283,1343#jm_eo_2333}]

so i use this regex code to remove brackets (?<=[=]).*\d In theory i should get only

jm_eo_2283,1343#jm_eo_2333

i have 2022-08-30 13:35:49,291 ERROR o.a.j.e.RegexExtractor: Error in pattern: '(?<=[=]).*\d'

Any idea what is going on?? Is a way to get the result without brackets?? enter image description here

enter image description here

CodePudding user response:

You can use

=[0-9]*#(.*[0-9])

See the regex demo. Keep the template field set to $1$, it will extract the value captured with the first parenthesized pattern part.

Details:

  • = - a = sign
  • [0-9]* - zero or more digits
  • # - a # char
  • (.*[0-9]) - Group 1 ($1$): any zero or more chars other than line break chars as many as possible, and then a digit.

CodePudding user response:

According to the JDBC Request sampler documentation:

If the Variable Names list is provided, then for each row returned by a Select statement, the variables are set up with the value of the corresponding column (if a variable name is provided), and the count of rows is also set up. For example, if the Select statement returns 2 rows of 3 columns, and the variable list is A,,C, then the following variables will be set up:

A_#=2 (number of rows)
A_1=column 1, row 1
A_2=column 1, row 2
C_#=2 (number of rows)
C_1=column 3, row 1
C_2=column 3, row 2

So you should be able to access:

  • first row as ${eo_id_1}
  • second row as ${eo_id_2}
  • etc.

More information: Using JDBC Sampler in JMeter

  • Related