Jmeter regex for extracting bounds

I need to extract a single number from a Jmeter answer using a regular expression extractor as part of the correlation.

Scenario:

<span>Abc456ABC</span>
If I use <span>(.*?)</span>, then I will get "Abc456ABC".
If I use <span>Abc(.*?)ABC</span>, then I will get "456".

But the left and right borders can change. The input may be: Abcdef789ABCgh

I only need a number [In the latter case, it is "789"]. Please suggest a suitable regular expression extractor.

Thanks in advance...

+4
source share
3 answers
<span>.*?([0-9]+).*?</span>

You can just use this. See the demo.

https://regex101.com/r/uE6jQ1/11

+2
source

You can use the following:

<span>\D+(\d+)\D+</span>

See Regex DEMO

+1
source

<span>([\w]+)(\d+)([\w+])</span>, , ,

$2 $

([\ w] +): it will capture all the words and (\ d +): take care of the numbers for you

+1
source

All Articles