/* Checks if the input string matches to the regular expression pattern. */
EFI_STATUS EFIAPI RegularExpressionMatch(IN EFI_REGULAR_EXPRESSION_PROTOCOL *This, IN CHAR16 *String, IN CHAR16 *Pattern, IN EFI_REGEX_SYNTAX_TYPE *SyntaxType OPTIONAL, OUT BOOLEAN *Result, OUT EFI_REGEX_CAPTURE **Captures OPTIONAL, OUT UINTN *CapturesCount)
/* Checks if the input string matches to the regular expression pattern. */
EFI_STATUS EFIAPI RegularExpressionMatch(IN EFI_REGULAR_EXPRESSION_PROTOCOL *This, IN CHAR16 *String, IN CHAR16 *Pattern, IN EFI_REGEX_SYNTAX_TYPE *SyntaxType OPTIONAL, OUT BOOLEAN *Result, OUT EFI_REGEX_CAPTURE **Captures OPTIONAL, OUT UINTN *CapturesCount)
{
  EFI_STATUS  Status;
  UINT32      Index;
  BOOLEAN     Supported;
  if ((This == NULL) || (String == NULL) || (Pattern == NULL) || (Result == NULL) || (CapturesCount == NULL)) {
    return EFI_INVALID_PARAMETER;
  }
  if (SyntaxType == NULL) {
    SyntaxType = mSupportedSyntaxes[0];
  } else {
    Supported = FALSE;
    for (Index = 0; Index < ARRAY_SIZE (mSupportedSyntaxes); ++Index) {
      if (CompareGuid (SyntaxType, mSupportedSyntaxes[Index])) {
        Supported = TRUE;
        break;
      }
    }
    if (!Supported) {
      return EFI_UNSUPPORTED;
    }
  }
  Status = OnigurumaMatch (String, Pattern, SyntaxType, Result, Captures, CapturesCount);
  return Status;
}