Hi. I’m new here. I’m developing a diet checker that users enter their recipe into an input field and compares it to an external text file with a list variables of ingredients and then underlines or highlights certain ingredients that would not be good to eat.
Here’s the problem:
I need to check this input box for certain words and see if there are specific words before or after those words.
Example of what the code needs to do:
The word “egg” WOULD BE highlighted/underlined as a bad ingredient but **“egg white” **would NOT have the “egg” part highlighted
The word “fried chicken” WOULD BE highlighted/underlined but “baked chicken” or “broiled chicken” would NOT be highlighted
The external variable text file lists the words I’m searching for and the words to replace them with but, the code I have cannot yet determine if the word **“white” **is after the word “egg” and then not have the “egg” part of the phrase underlined.
Hope I made this clear. I’d appreciate any help on this.
Thanks!