fix parenthesis and detection of word search in string mode (fixes #4078)