Skip to content
  • Ahmad Samir's avatar
    Fix the port to QRegularExpression · 7d2cfbe4
    Ahmad Samir authored
    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.
    7d2cfbe4