Yes you can read in a string of characters the way you specify... but the problem is you are locked in the HSERIN or SERIN command until the number of characters that you specify in your string have arrived. If it's a keyboard input from a host for example, and they go off for a Coffee and a natter in the little-boys room half-way thru the string, then so does your PIC. The best way is to poll the Received Flag in the USART by background interrupt and continually feed a ring buffer. But that's a subject for another time.

No problem with comparing against what's in program-codespace rather than in EEPROM. My example was written that way so people can understand and play with it more easily.