使用正则表达式(greta库)判断文件路径是否合法

//头文件与名字空间
#include <iostream>
#include <string>
#include "regexpr2.h"
using namespace std;
using namespace regex;
//代码段
if (m_file_path.Right(1)==_T("\\"))
{
 m_file_path=m_file_path.Left(m_file_path.GetLength()-1);
}
USES_CONVERSION;
match_results results;
rpattern pat(_T("^(([a-zA-Z]:|\\\\)\\\\)?(((\\|<>\\.   ])|([^\\\\/:\\*\\?\"\\|<>\\.   ](([^\\\\/:\\*\\?\"\\|<>\\.   ])|([^\\\\/:\\*\\?\"\\|<>]*[^\\\\/:\\*\\?\"\\|<>\\.   ]))?$"));
_tstring str=m_file_path.GetBuffer(0);
match_results::backref_type br = pat.match( str, results);
if( br.matched )
{
  m_file_path+=_T("\\");
  if (!PathFileExists(m_file_path.Left(2)))
  {
   *pret=-1;  
   m_edit_file_path.SetFocus();
   AfxMessageBox(g_LoadString(IDS_STRING_PATH_NOT_CORRECT));
  }
}
else
{
  if (!PathFileExists(m_file_path) ||
   m_file_path.Right(1)==_T("\\"))
  {
   *pret=-1;
      m_edit_file_path.SetFocus();
      AfxMessageBox(g_LoadString(IDS_STRING_PATH_NOT_legitimate));
  }
  else
  {
  }
}