My database stores a message (string) and its corresponding regex which replaces some variable information (like date, amount, etc). Once the regex has been identified and stored in the database, all the messages similar to the one in the database (regex) should be filtered out (using preg_match()). However, when I store the following in my database, the similar messages aren't getting filtered out.
$message = Payment received NEFT - Your account account_number has been credited for some_amount from some_sender vide Txn ref some_ref_num.
$corresponding_regex = Payment received NEFT \- Your account (.*) has been credited for (.*) from (.*) vide Txn ref (.*)
I am guessing the problem is with 'NEFT'. Because, if I remove it, the similar messages get filtered out. But, I can't replace NEFT with (.*) as that information is essential for me.
How do I ensure that the similar messages get filtered out without replacing NEFT from my regex?