PDA

View Full Version : QRegExp



evgenM
24th March 2006, 12:46
i have text : -->>text1"in quote1" text2"in quote2" text3<<---

i use string.remove(QRegExp("\".*\""))
and get ->>text1 text3<<--
but i want get -->>text1 text2 text3<<--
whats wrong?

wysota
24th March 2006, 12:50
By default regular expressions try to match as much data as they can -- in your case this causes .* to match as many characters as it can, so it swallows everything up to the last quotation mark. You have to ask the expression to match as less data as it can. To do this, call setMinimal(true) on the regexp object.

evgenM
24th March 2006, 12:52
hmm thanx i will try