Detect the operating system and use the appropriate word boundary syntax.