Forum Discussion

ohaya's avatar
ohaya
Contributor
2 years ago

How to make "Contains" assertion for matching one of 2 words?

Hi,

I want to make an assertion in a SOAPUI test step that matches one of two words, "Permit" or "Deny", but I can't seem to be able to do that.

 

I've tried the Contains assertion with things like (this is with the "Regular expression" checkbox checked:

 

Permit|Deny

(Permit|Deny)

 

But I keep getting different errors.

 

Can someone tell me what the Contains assertion should look like?


Thanks,

Jim

  • ohaya's avatar
    ohaya
    Contributor

    I think I found the answer.

     

    Apparently, "When using regular expressions in an assertion in SoapUI, you have to take whitespace and line breaks into account. In the example code (?s).* works as a wildcard that includes all whitespace and line breaks."

     

    The following Contains assertion (with regex checkbox checked) seems to work:

     

    ((?s).*Deny(?s).*)|((?s).*Permit(?s).*)

     

    Thanks,

    Jim