In Groovy, you can use the following check (assuming text
is the variable holding the string you provided in the question):
if (text=~/Server returned HTTP response code: 503\b/){
println "503 code detected"
} else {
println "503 code not detected"
}
But it also seems you can just use contains
:
if (text.contains('HTTP response code: 503 ') {...}
4
solved How can I check if an XML response contains a pattern? [closed]