PDA

View Full Version : QRegExp for matching string between quotes with escaped quotes



horeste12
16th April 2012, 22:18
I tried to find a QRegExp expression for matching text between quotes with escaped quotes inside, but i couldn't find one. Also, I am a newbie and I can't really figure this out by my own. Any help would be appreciated. Thanks!

wysota
16th April 2012, 23:22
If you can't find a working regular expression then solve your problem without a regular expression.

ChrisW67
17th April 2012, 00:41
You can find possible partial solutions here (http://www.regular-expressions.info/examplesprogrammer.html) under the heading "Strings". Regular expression matching of balanced delimiters can be a very tricky proposition depending on how limited (or not) your input is. Even when you think you have it you can almost certainly find a case that will break it.

Often a non-regex approach is clearer, easier to debug, and comparably fast.

fullmetalcoder
17th April 2012, 17:05
QRexgExp("\"(\\\\\"|[^\"])+\"")