28  start = startSelectionPos;
 
   29  end = endSelectionPos;
 
   31  expression = text.mid( startSelectionPos, endSelectionPos - startSelectionPos ).replace( QChar( 0x2029 ), QChar( 
'\n' ) );
 
   35  if ( startSelectionPos != endSelectionPos )
 
   41  const QRegularExpression regex( pattern.isEmpty() ? EXPRESSION_PATTERN : pattern );
 
   42  QRegularExpressionMatchIterator result = regex.globalMatch( text );
 
   44  while ( result.hasNext() )
 
   46    const QRegularExpressionMatch match = result.next();
 
   49    if ( match.capturedStart() < startSelectionPos && match.capturedEnd() > endSelectionPos )
 
   51      start = match.capturedStart();
 
   52      end = match.capturedEnd();
 
   54      expression = match.captured( 1 );
 
   56      expression = expression.replace( QChar( 0x2029 ), QChar( 
'\n' ) );
 
 
   83  int startPosition = editor->textCursor().selectionStart();
 
   84  int endPosition = editor->textCursor().selectionEnd();
 
   87  int newSelectionStart, newSelectionEnd;
 
   88  findExpressionAtPos( editor->toPlainText(), startPosition, endPosition, newSelectionStart, newSelectionEnd, res, pattern );
 
   90  QTextCursor cursor = editor->textCursor();
 
   91  cursor.setPosition( newSelectionStart, QTextCursor::MoveAnchor );
 
   92  cursor.setPosition( newSelectionEnd, QTextCursor::KeepAnchor );
 
   93  editor->setTextCursor( cursor );
 
 
  102  int startPosition = editor->textCursor().selectionStart();
 
  103  int endPosition = editor->textCursor().selectionEnd();
 
  106  int newSelectionStart, newSelectionEnd;
 
  107  findExpressionAtPos( editor->toPlainText(), startPosition, endPosition, newSelectionStart, newSelectionEnd, res, pattern );
 
  109  QTextCursor cursor = editor->textCursor();
 
  110  cursor.setPosition( newSelectionStart, QTextCursor::MoveAnchor );
 
  111  cursor.setPosition( newSelectionEnd, QTextCursor::KeepAnchor );
 
  112  editor->setTextCursor( cursor );
 
 
static void findExpressionAtPos(const QString &text, int startSelectionPos, int endSelectionPos, int &start, int &end, QString &expression, const QString &pattern=QString())
Find an expression at the given position in the given text.