From 141e73f9b2b082c5f3a8bda3d2ab43c42684230e Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Mon, 25 Jun 2012 08:46:14 +0200 Subject: [PATCH] be more strict with us state replacement hack replace il/al/la only if they are properly separated by a comma --- website/search.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/website/search.php b/website/search.php index f0bcf077..53314d51 100755 --- a/website/search.php +++ b/website/search.php @@ -109,10 +109,9 @@ $sQuery = str_ireplace(array('New York, ny','new york, new york', 'New York ny','new york new york'), 'new york city, ny', $sQuery); if (isset($aLangPrefOrder['name:en'])) { - $sQuery = preg_replace('/\\bil\\b/','illinois', $sQuery); - $sQuery = preg_replace('/\\bal\\b/','alabama', $sQuery); - $sQuery = preg_replace('/\\bla\\b/','louisiana', $sQuery); - $sQuery = preg_replace('/\\bde louisiana\\b/','de la', $sQuery); + $sQuery = preg_replace('/,\s*il\s*(,|$)/',', illinois\1', $sQuery); + $sQuery = preg_replace('/,\s*al\s*(,|$)/',', alabama\1', $sQuery); + $sQuery = preg_replace('/,\s*la\s*(,|$)/',', louisiana\1', $sQuery); } // If we have a view box create the SQL -- 2.39.5