c++ - QRegExp - How to get specific text between two HTML tags -


I want to remove some text from the following HTML code in " Qt / C ++ " < Code> QRegExp .

  & lt; Table range = "0" width = "99%" & gt; & Lt; COLGROUP & gt; & Lt; Col width = "100" & gt; & Lt; COL & gt; & Lt; TR & gt; & Lt; TD align = "center" valign = "middle" bgcolor = "# EEEEFF" & gt; & Lt; B & gt; MCT-to-K.R. & Lt; / P & gt; & Lt; TD align = "center" valign = "middle" bgcolor = "# EEEEFF" & gt; Font class = "result" & gt; This is the text that I want; / Font & gt; & Lt; TR & gt; & Lt; TD align = "center" valign = "middle" bgcolor = "#dddDEE" & gt; Generalized & lt; TD align = "center" valign = "middle" bgcolor = "#ddddee" & gt; [AL-LYA-A] & LT; TR & gt; & Lt; TD align = "center" valign = "middle" bgcolor = "# ccccdd"> Web Unicode & lt; Td align = "center" valign = "middle" bgcolor = "# ccccd" & gt; The second lesson may be interested, but if it is done for the first time it will be easy & lt; / Table & gt;  

I can do this in C #Net :

  Personal Regex txtExtractor = New Regex (@ "& lt; Fun class = "" result "" & gt; (. *?) & Lt; / font & gt; ");  

I was tired of it with QRegExp but did not work, so how do I edit it to work? QRegEx (Qt 4 and Qt 5)

  using the QRegExp regex ("& lt; font class = \" result 

result \" and gt; & lt (*.); / Font & gt; "); Regex.indexIn (html); Quastering lesson = regex.cap (1);

Using QRegularExpression (Qt 5)

  QRegularExpression regex ("& lt; font class = \" result \ "& gt; (. *) & Lt; / FONT & gt; "); QRegularExpressionMatch match = regex.match (html); Qestring lessons = match-capitalized (1);  

If you are using Qt5, then I recommend using the QRegularExpression . This API is a little better.


Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -