1

I've read the other responses on adding delimiters, however the line the error message is calling out does not have a '.' in it.

This is the error message:

Warning: preg_match(): No ending delimiter '.' found in /homepages/17/d257823593/htdocs/includes/file.inc on line 895.

Here is the code(first line is line 895):

elseif ($depth >= $min_depth && preg_match($mask, $file)) {
          // Always use this match over anything already set in $files with the same $$key.
          $filename = "$dir/$file";
          $basename = basename($file);
          $name = substr($basename, 0, strrpos($basename, '.'));

Any help would be greatly appreciated.

smottt
  • 3,272
  • 11
  • 37
  • 44
user4418447
  • 27
  • 1
  • 2

1 Answers1

1

The first character of a regular expression is the designated delimiter and must be complemented by another one at the end (*) (**)

In your case it would seem that your $mask variable starts with ., e.g. .something$; you should use a proper delimiter, such as the default one:

/.something$/

(*) before the expression modifiers (**) the ending delimiter is not necessarily the same character

Reproduction of your error:

$str = 'Hello test world!';
$mask = '.*';

echo preg_match($mask, $str); // Warning: preg_match(): No ending delimiter '.' found in /tmp/execpad-2054fb2e6491/source-2054fb2e6491 on line 6

Using delimiters:

$str = 'Hello test world!';
$mask = '~.*~';

echo preg_match($mask, $str); // 1
scrowler
  • 24,273
  • 9
  • 60
  • 92
Ja͢ck
  • 170,779
  • 38
  • 263
  • 309