original_string: protected function assertPattern($pattern)
      {
          if (strlen($pattern) == 0) return null;
  
          $pattern = '/^'. str_replace('/', '\\/', $pattern). '$/';
          if (@preg_match($pattern, null) === false) {
              throw new DefinitionException("invalid regular expression pattern");
          }
  
          return $pattern;
      }
code: protected function assertPattern($pattern)
      {
          if (strlen($pattern) == 0) return null;
  
          $pattern = '/^'. str_replace('/', '\\/', $pattern). '$/';
          if (@preg_match($pattern, null) === false) {
              throw new DefinitionException("invalid regular expression pattern");
          }
  
          return $pattern;
      }
code_tokens: protected function assertPattern ( $ pattern ) { if ( strlen ( $ pattern ) == 0 ) return null ; $ pattern = '/^' . str_replace ( '/' , '\\/' , $ pattern ) . '$/' ; if ( @ preg_match ( $ pattern , null ) === false ) { throw new DefinitionException ( "invalid regular expression pattern" ) ; } return $ pattern ; }
docstring: Validate the regular expression pattern string
  @param string $pattern
  @return string|null
  @throws DefinitionException
docstring_tokens: Validate the regular expression pattern string