I have a system written in PHP which aggregates records from a number of databases in to one. When doing this I need to detect if each record is ABNORMAL and if it is, flag it as being so.
To do this I need a pattern for preg_match() so it will return false if the given string contains the word NORMAL but not ABNORMAL. The string given may be over multiple lines.
The problem I am having is that the word ABNORMAL contains the word NORMAL.
Can anyone help?
Use the word boundry character
\b:Note that it is case sensitive, the case insensitive version is this:
Though if you have control over you database, you might want to use 0 and 1 (or at least N and A) instead of NORMAL and ABNORMAL.