# Checking input box data for specific phrases

**URL:** <https://forum.kirupa.com/t/checking-input-box-data-for-specific-phrases/174987>\
**Category:** flash\
**Created:** [January 10, 2006, 9:14pm UTC](https://forum.kirupa.com/t/checking-input-box-data-for-specific-phrases/174987 "2006-01-10T21:14:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![interactiveed](https://avatars.discourse-cdn.com/v4/letter/i/7ea924/32.png) [@interactiveed](https://forum.kirupa.com/u/interactiveed)\
**Post date:** [January 10, 2006, 9:14pm UTC](https://forum.kirupa.com/t/checking-input-box-data-for-specific-phrases/174987/1 "2006-01-10T21:14:36Z")

</div>

## 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!
