Results 1 to 3 of 3

Thread: Help me make regular expression fits my purpose

  1. #1
    Join Date
    Apr 2013
    Posts
    6
    Qt products
    Qt4
    Platforms
    Windows

    Default Help me make regular expression fits my purpose

    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.

  2. #2
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: Help me make regular expression fits my purpose

    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
    Qt Code:
    1. QRegExp rx("\"[^\"]*\""); // "[^"]*"
    To copy to clipboard, switch view to plain text mode 
    Last edited by Santosh Reddy; 29th April 2013 at 15:17.
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

  3. #3
    Join Date
    Apr 2013
    Posts
    6
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Help me make regular expression fits my purpose

    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.

Similar Threads

  1. Regular expression
    By aguleo in forum Newbie
    Replies: 0
    Last Post: 25th January 2013, 15:00
  2. Regular expression help neede
    By aurora in forum Qt Programming
    Replies: 13
    Last Post: 19th January 2012, 11:03
  3. Regular expression
    By QFreeCamellia in forum Newbie
    Replies: 8
    Last Post: 30th December 2011, 22:34
  4. Regular expression help!
    By ConkerX in forum Qt Programming
    Replies: 10
    Last Post: 31st August 2011, 15:47
  5. Help with regular expression
    By Gourmet in forum General Programming
    Replies: 19
    Last Post: 11th August 2011, 15:04

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.