Please nominate your Qt Champions for 2021!

Validating filename including predefined tags using QRegExp

  • In my application I have line edit where user can enter a file name which will be used as the file name to save image while archiving with FTP.

    I have a combo box from which user can also select some predefined tags for the file name which is enclosed in . Eg:

    <XXCOUNTER> -> This tag user can edit to replace XX with 00..09

    I want to allow user to manually enter these tags also. When user starts entering name the validation should be done and if found invalid then I will display the name in red color else in green color.

    Also I will not allow user to enter special characters which cannot be used in file name like |, /, ?, , ", :, *

    Image_<COUNTER>     -     Valid
    Image_<COUNTER><    -     Invalid
    Name<12COUNTER>     -     Invalid

    How I can achieve validating the name which including the tags[<>] by using RegExpression[QRegExp]?

Log in to reply