Im altering another developers code (without luck) - its an addition to some preg_replace formulas so I don’t want to break anything. Hopefully I can explain this correctly:
The code is currently setup as follows:
const EXERCISE_FILE_TITLE_RULE = "^(?:[0-9.]+)[-_]+(.*)\\.mp3$";
const SPACE_REPLACER = '_';
$filename = 23-Z_ae.mp3;
if ( preg_match('/'. EXERCISE_FILE_TITLE_RULE ."/i", $file_name, $m ) ) {
$info['title'] = preg_replace(
array( '/'. SPACE_REPLACER ."+/i", '/'. KEYWORDS_REPLACER ."/i" ),
array(' ', null),
$m[1] );
}
This produces the correct result:
Array
(
[title] => Z ae
)
I need to change the preg_replace expression so that if recognises if the additional following pattern is in the $filename:
$filename = 23-_[Z]__ae.mp3;
It needs to pickup the letter or letters inside [ ]
In this case something like this would be produced:
Array
(
[title] => *Z* ae
)
Can anyone please help?