c++ - Regex with Qt capture some text -


i capture second occurence of text replaced star in following string:

&nbsp;sw * <br> 

ie string starting &nbsp;sw ending <br> in qstring, using regex qt.

an example here: string

&nbsp;&nbsp;sw = min(1, max(0, pow(10, -0.2 - 6.5 ) ** (1.0 / 0.2)))<br> 

and expected result

= min(1, max(0, pow(10, -0.2 - 6.5 ) ** (1.0 / 0.2))) 

so far, have qregexp rx("^[\&nbsp;sw](.*)[<br>]$"); not compiling.

how ?

the compilation issue due trying escape ampersand (\&). other that, regex right, overusing character groups ([]), not grouping. expression works in tests: &nbsp;sw(.*)<br>, in case you'd like

qregexp rx("&nbsp;sw(.*)<br>") 

Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -