I have a string of "You can go to kitchen and get some food for your dinner" and i need to change with preg_replace words You, your, food case insensitive to <i>y</i>ou,<i>y</i>our,<i>f</i>ood
Is there i a pattern to match first character of a specific words in the string? Can someone give examples
input text not matching
You can generalize the pattern to just match words using the
\bword boundary class, usepreg_replace_callback(), and a list of target words to make this more easily extensible. Eg:Output: