对几个选项进行preg_match验证,否则替换为null

i need to validate my string variable, it MUST contain one of these options: Waiting, Ok, Rejected, Unpaid, Expired. How can i write regex on few options?

Something like:

  $data = "Waiting text";

    if(preg_match('[Waiting|Ok|Rejected|Unpaid|Expired]', $data)) { } else { }

Here is documentation for regexp alternations: http://php.net/manual/en/regexp.reference.alternation.php

if (preg_match('/^Waiting|Ok|Rejected|Unpaid|Expired$/', $str, $matches)) {
  //..
}

But you could not use regex for such requirements, you could check it whether it is in an array:

$valid_status = array('Waiting', 'Ok', 'Rejected', 'Unpaid', 'Expired');
if (in_array($str, $valid_status, true)) {
  //..
}