What are the potential pitfalls of using REGEXP in PHP for database queries?

Using REGEXP in PHP for database queries can lead to performance issues, as regular expressions can be resource-intensive. It can also make the code less readable and harder to maintain. To mitigate these pitfalls, it's recommended to use more efficient alternatives like string functions or SQL operators whenever possible.

// Example of using SQL LIKE operator instead of REGEXP in PHP
$searchTerm = 'example';
$query = "SELECT * FROM table WHERE column LIKE '%$searchTerm%'";
$result = mysqli_query($connection, $query);