Skip to content

Instantly share code, notes, and snippets.

@loadster
Created June 19, 2014 21:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save loadster/4e15b1b6bf9706c0a99d to your computer and use it in GitHub Desktop.
Save loadster/4e15b1b6bf9706c0a99d to your computer and use it in GitHub Desktop.
Validate a response contains a string that matches a regular expression
function validate(response) {
var regex = /Confirmation #AWB(\d{8})Z/gm;
var matched = regex.test(response.bodyAsString);
return matched; // Validation is successful if the regex matched
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment