I need to check the given sentence is matched with existing templates.
example
User input:
Dear Ram, hello this is the 8th message with some cookies. This will make the sentence8th.
Predefined Template:
Dear {#var#}, hello this is the {#var#} message with some {#var#}. This will make the sentence{#var#}.
This will return TRUE.
Note: Predefined templates may/may not have spaces.
I am not familiar with pregs. I figured myself with mysql query
$sql = "SELECT template_id FROM templates WHERE ‘$userinput’ LIKE REPLACE( REPLACE(template_text, ‘{#var#}’, ‘%’),‘/’, ‘’) ";
Just wondering is there any other way to fasten the process?
Perl-compatable REGular expressions. (don’t ask where the E in expressions went.)
The family of functions that php uses for regex matching. preg_match, preg_split, etc.