For QSyntaxHighlighter I need regular expression which still cannot create. Rules are:

- word delimiters are:
Qt Code:
  1. " ' ; . , : ( ) { } [ ]
To copy to clipboard, switch view to plain text mode 
or <any whyte space>
- all sequences containing any other character, placed between delimeters are words, they must match to pattern only if they are completely equal to pattern
- subwords inside words (i.e. "sub" inside "submarine" or "prosubmitter" or "subsub") must not match to pattern

The rule must be single, not a set of rules. This is mandatory because of word pattern is taken from unknown list of words. It is only known that words cannot contain delimeters but all other characters they can contain. Proper words are:

Qt Code:
  1. if
  2. =
  3. !=
  4. ==
  5. +
  6. -
  7. hello_world
  8. cdt*12ad
  9. +++---
  10. 12/5/1
To copy to clipboard, switch view to plain text mode 
and so on. Again - they must match as whole words.

I tried several variants. Most complex part is with word match. If I create pattern like this:
Qt Code:
  1. "\\b" + pattern + "\\b"
To copy to clipboard, switch view to plain text mode 
then only equal words match but words like "++" do not match. If I create pattern like:
Qt Code:
  1. "(" + pattern + ")"
To copy to clipboard, switch view to plain text mode 
then any "+" or similar words match but even subwords match like this: "stop" becomes highlighted inside word "ifstopped".

Anybody familiar with regular expressions, please help me. The "virtual beer" will be granted.