Hi,
I have the situation where I need a user to be able to set a (some) characters to either separate fields or end a line in an input interpreter. Once I have a set of RegExp matches (QStringList), I then write them out. I have added options for the user to set how they want the fields separated and then the lines ended, the code to do it looks something like;

Qt Code:
  1. QByteArray result;
  2. if(-1 != regExpMatcher.indexIn(regExpBuffer.constData()))
  3. {
  4. regExpBuffer.clear();
  5. QStringList captures = regExpMatcher.capturedTexts();
  6. int numberOfCaps = captures.size();
  7. if(numberOfCaps > 1)
  8. {
  9. for(int i=1; i < numberOfCaps; i++)
  10. {
  11. result.append(captures.at(i));
  12. if(i != (numberOfCaps-1))
  13. result.append(seperator.toAscii());
  14. }
  15. }
  16. else
  17. result.append(captures.at(0));
  18. result.append(lineEnd.toAscii());
  19. }
To copy to clipboard, switch view to plain text mode 
My problem is, if a user wants to enter a TAB as the seperator '\t' or some variant of a newline '\r\n'. How do I easily parse their input? What I would LOVE is something similar to the way the RegExps are done, some one character escapes for the common ones \0x00 (or \0xxx) for others. Of course I could write a parser, but surely there is an easy 'QT way' for this?

Any ideas?