Fix the port to QRegularExpression
I made some mistakes when porting from QRegExp to QRegularExpression:
- With QRegularExpression::DotMatchesEverythingOption enabled, better use QRegularExpression::anchoredPattern and not rely on "^" and "$" to anchor the pattern (anchoredPattern uses "\A" and "\z" which is more accurate/precise)
- Disable QRegularExpression::DotMatchesEverythingOption before subsequent setPattern calls, it's only needed for the first matching
- When calling setPattern, obviously the previous QRegularExpression::anchoredPattern isn't going to be in effect, call it again if you want the pattern to be anchored
Thanks to sitter for the unit tests that exposed the issue, and for spotting the issue with needing to anchor the pattern.
All unit tests pass.