Help with REGEXP in mySQL WHERE
I have a large mySQL Db table that contain cemetery burial information. One field contains military information about service branch and campaigns (e.g., Korea, Vietnam).
Using a string search value with %...% works fine for most of the campaigns. But, searching for %World War I% also selects the records containing 'World War II'. Thus, I changed the search to use a REGEXP '\bWorld War I\b' but this returns zero records.
This is the code...
SELECT * FROM memorials
LEFT JOIN cemeteries ON cem_id = per_cemid
WHERE per_cemid = 134
AND (per_mil_inscription REGEXP '\bWorld War I\b'
OR per_mil_notes REGEXP '\bWorld War I\b')
The code doesn't work in my PHP code and doesn't work in a cPanel SQL query.
What am I doing wrong?
TIA for any assistance
--
James A Wilson
msgwcc@msholmes.org
Subject
Written By
Posted
Help with REGEXP in mySQL WHERE
December 04, 2025 11:54AM
Sorry, only registered users may post in this forum.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.