diff --git a/media_gallery/media_gallery.fields.inc b/media_gallery/media_gallery.fields.inc index 74a030c..975448d 100644 --- media_gallery/media_gallery.fields.inc +++ media_gallery/media_gallery.fields.inc @@ -224,10 +224,10 @@ function _media_gallery_get_media_title($file) { else { $replacements = array( '/\..*/' => '', // Remove first "." and everything after. - '/[^a-zA-Z0-9]+/' => ' ', // Replace non letters or numbers with a single space. - '/([a-z])([A-Z])/' => '\1 \2', // Insert a space between a lowercase letter and an uppercase letter. - '/([a-zA-Z])([0-9])/' => '\1 \2', // Insert a space between a letter and a number. - '/([0-9])([a-zA-Z])/' => '\1 \2', // Insert a space between a number and a letter. + '/([^\pL\pN])+/u' => ' ', // Replace non letters or numbers with a single space. + '/(\pL])(\pLu)/u' => '\1 \2', // Insert a space between a lowercase letter and an uppercase letter. + '/(\pL)(\pN)/u' => '\1 \2', // Insert a space between a letter and a number. + '/(\pN)(\pL)/u' => '\1 \2', // Insert a space between a number and a letter. ); // In addition to above replacements, also capitalize the first letter of // each word, and remove leading and trailing spaces.