c++ - Regex with Qt capture some text -
i capture second occurence of text replaced star in following string:
sw * <br>
ie string starting sw
ending <br>
in qstring, using regex qt.
an example here: string
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("^[\ 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: sw(.*)<br>
, in case you'd like
qregexp rx(" sw(.*)<br>")
Comments
Post a Comment