regex ends with space or end of line code example Example: php preg match space or start of string /\b(stackoverflow)\b/