I'm working with Python bindings for Qt4.8 on OS X.

* I want to accept any digit and a few other chars AND white space.
* String can be empty or at any length.
* What I **don't want** is, for the **string to being or end with white space.**

My working example: `'[0-9pqw\+\-\*\#\(\)\.][0-9pqw\+\-\*\# \(\)\.]*'`

However, I don't want to repeat two blocks one containing space one does not. There should be a better way I guess, employing [^ ], but how?

Second question:

* If I want to limit strings total length, how would I do it?

Thank you.