[Qt-interest] Some characters breaking QRegExp

Paul England pengland at cmt-asia.com
Wed Oct 20 10:34:54 CEST 2010


Hi.

I think I have some characters which are breaking my QRegExp.

It's a simple one to read specific tags out of a webpage.

QRegExp rx_val(  ".*font-family:.+\">(.+)<!.*" );

     while ( !page.atEnd() ) {
        if ( rx_val.indexIn( line ) != -1 ) {
               // parse;
        }
    }

Here are some examples that work:

<td style="margin: 2px; padding: 1px; border: 0px solid; "><!--defang_font size="1" face="Verdana" style--><span style="font-size: x-small; font-family: Verdana; ">Rhythm Game<!--/defang_font--></span></td>
<td style="margin: 2px; padding: 1px; border: 0px solid; "><!--defang_font size="1" face="Verdana" style--><span style="font-size: x-small; font-family: Verdana; ">Darkside Digital Records<!--/defang_font--></span></td>

These two do not.  The only difference is the apostrophe in one, and the parenthesis in the others.

  <td style="margin: 2px; padding: 1px; border: 0px solid; "><!--defang_font size="1" face="Verdana" style--><span style="font-size: x-small; font-family: Verdana; ">Wally Lopez, Ismael Rivas (aka Riva), Marshall (aka Luigi Rocca)<!--/defang_font--></span></td>
  <td style="margin: 2px; padding: 1px; border: 0px solid; "><!--defang_font size="1" face="Verdana" style--><span style="font-size: x-small; font-family: Verdana; ">Eric Volta's Bust That Remix<!--/defang_font--></span></td>


I've never heard of the string being searched having have characters escaped.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20101020/f885f8f8/attachment.html 


More information about the Qt-interest-old mailing list