Forum Discussion

GlorianChris's avatar
GlorianChris
Occasional Contributor
7 years ago

Using Negative Lookahead in RegEx Assertions

I'm trying to use RegEx in a NotContains response assertion (SOAPUI 5.4.0) to find empty tags that don't have a particular name.   For instance, given the response: <SOAP-ENV:Header xmlns:SOAP-ENV...
  • JHunt's avatar
    7 years ago

    I don't claim to know how Not Contains assertions work (like you, I am a bit puzzled by its behaviour).

     

    But I put your RegEx into a Script assertion and it seems to do what you want:

     

    assert !(messageExchange.response.responseContent =~ /(?!(<SOAP-ENV))<.*\/>/)