Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QRegExp not supporting \n back-references in Lookaheads?

QRegExp not supporting \n back-references in Lookaheads?

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 1.7k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    dcortesi
    wrote on last edited by
    #1

    Per the QRegExp class ref, a search expression can refer back to captured text with a backreference, \n, and gives an example. However this appears not to be working when the backreference is within a lookahead, for example the expression,
    @<(i)>[^<]+</(?!i)>@
    will find a bad italic markup such as
    @<i>...</q>@
    However, the same with a backreference,
    @<(i)>[^<]+</(?!\1)>@
    does not find anything, nor of course the generalized version,
    @<(\w+)[^>]*>[^<]+</(?!\1)>@
    either. Does anyone know if this a bug or a planned restriction?

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on last edited by
      #2

      QRegExp is indeed rather limited. I don't know if this issue you run into is a (known) limitation (can't find it in de docs with a quick scan). However, I do know that this issue will be addressed in Qt 5, as the regexp engine will be replaced by something a bit more standard, featured and performant.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved