私は以前に尋ねた質問を拡張しようとしています。preg_replace を使用して、単語全体または単語を特定の句読点または記号に突き合わせて切り替えたいと思います
\s\,\:\-\%\(\)\*\&\$\#\!\@\"\;
。現在、私はこのようなものを使用しています。
$_SESSION['ABBREV']['GENERAL']['SEARCH'][] = '/(?<=\s|^)' . preg_quote($row['word'], '/') . '(?=\s|$)/i';
$_SESSION['ABBREV']['GENERAL']['REPLACE'][] = ucwords($row['abbrev']);
$word = $_SESSION['ABBREV']['GENERAL']['SEARCH']; --array that holds whole words
$abbrev = $_SESSION['ABBREV']['GENERAL']['REPLACE']; --array that stores abbreviations
$string = 'James Laughlin Music Center, Chatham University';
$new_word = = preg_replace($word, $abbrev, $string);
チャタム大学の James Laughlin Music Cntr. として出てきてほしいです。センターの略です。なんらかの理由で James Laughlin Music,Center Hall Chatham University が James Laughlin Music,Cntr. ホール チャタム大学。うまく説明できているか自信がありません。