Search code examples
regexjmeterline-breaks

Match multiple line breaks with regex in JMeter Regular Expression Extractor


I try to use regex to extract text from text response, which contains multiple line breaks.

Sample text:

                                    <td class="comment-text">

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum, 
                                    </td>
                                </tr>

I use this regex: https://regex101.com/r/jNyALD/1


Solution

  • Put the boundaries in regex

    <td class="comment-text">([^<]+)<\/td>
    

    Notice you can also use Boundary Extractor

    Allows the user to extract values from a server response using left and right boundaries.