PDA

View Full Version : Help on QRegExp please



lni
10th August 2010, 03:51
Hi,

I have a string with format like:

str1 .str2 str3_with_possible_white_space : str4_with_possible_white_space | str5

where
(1) str1 must exist
(2) after str1, any or all patterns may be missing.

How do I use QRegExp to strip out the elements?

Thanks!

Lykurg
10th August 2010, 06:38
What have you tried so far?

lni
11th August 2010, 04:55
I am currently using QString::indexOf to search ".", ":", and "|", which is very tedious... QRegExp would be much simpler, but I can't get the pattern right...

Lykurg
11th August 2010, 06:57
Please post a sample line. And how look your tried pattern, which wont work?