Skip to content
Commit 7d2cfbe4 authored by Ahmad Samir's avatar Ahmad Samir
Browse files

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.
parent 7512f620
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment