PDA

View Full Version : Help me make regular expression fits my purpose



cactus0830
29th April 2013, 14:04
Hi there.

I'm a newbie in QT n in trouble with making regular expression.

I want to find words in the double qoutation mark.

So far, i used QRegExp rx("\"([A-Za-z0-9_\\./\\-\\s]*)\""), but i found out this expression cannot find words include special characters.

How should i change my expression to make it better?

eg. <FTP APP="EWS_TEMA" IP="122.298.17.222" USER="hifix03" PASSWD="AwJtzlhqWmtY=|" RDIR="/users/Hifix03/RTE_FILE" LDIR="/Tmp" TIMEOUT="60" USE="Y">

I want to get "EQS_TEMA", "122.298.17.222", "hifix03" and so on INCLUDE "AwJtzlhqWmtY=|"

Anybody can save my life?

Thx in advance.

Santosh Reddy
29th April 2013, 15:03
So far, i used QRegExp rx("\"([A-Za-z0-9_\\./\\-\\s]*)\""), but i found out this expression cannot find words include special characters.
Include the special characters in the pattern then.

Just include every thing excpet " character it self


QRegExp rx("\"[^\"]*\""); // "[^"]*"

cactus0830
29th April 2013, 16:21
First of all, thx with your reply.

There is no pattern about when the special character to be shown.

Cuz, as u can see the example above, the password is encrypted so i cannot expect where the special character is located.

The on clue i have to cling to is double equation marks.