C++ (Qt) QRegExp rx("^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\:\\d{1,5}"); int pos = rx.indexIn("Length: 36 inches 22.33.44.55:99 dfsf sdfdgs sdgsdg s4343 34534. 343434 // 43454.. ..344"); QStringList list = rx.capturedTexts(); char *prox; for (int i = 0; i < list.size(); i++) prox=list.at(i); ui->textEdit->append(prox);
C++ (Qt) QRegExp rx("\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\:\\d{1,5}"); int pos = rx.indexIn("Length: 36 inches 22.33.44.55:99 dfsf sdfdgs sdgsdg s4343 34534. 343434 // 43454.. ..344"); QStringList list = rx.capturedTexts(); const char *prox; for (int i = 0; i < list.size(); i++) prox=list.at(i).toLocal8Bit().constData(); //ui->textEdit->append(prox); MessageBoxA(0, prox, prox, 0);
void QTextEdit::append ( const QString & text )
C++ (Qt) QRegExp rx("\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\:\\d{1,5}"); int pos = rx.indexIn("Length: 36 inches 22.33.44.55:99 dfsf sdfdgs sdgsdg s4343 34534. 343434 11.23.45.67:8888 // 43454.. ..344"); QStringList list = rx.capturedTexts(); const char *prox; for(int i = 0; i < list.size(); i++) { ui->textEdit->append(list.at(i).toLocal8Bit().constData()); MessageBoxA(0, list.at(i).toLocal8Bit().constData(), "Caption", 0); }
QString str = "твоя строка";int pos = 0; while ((pos = rx.indexIn(str, pos)) != -1) { list << rx.cap(0); pos += rx.matchedLength(); }
C++ (Qt) QRegExp rx("\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\:\\d{1,5}"); QString str = "Length: 36 inches 22.33.44.55:99 dfsf sdfdgs sdgsdg s4343 32.43.54.65:99 34534. 343434 11.23.45.67:8888 // 43454.. ..344"; QStringList list; int pos = 0; while ((pos = rx.indexIn(str, pos)) != -1) { list << rx.cap(0); pos += rx.matchedLength(); } for(int i = 0; i < list.size(); i++) { ui->textEdit->append(list.at(i).toLocal8Bit().constData()); MessageBoxA(0, list.at(i).toLocal8Bit().constData(), 0, 0); }
C++ (Qt) QRegExp rx("\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\:\\d{1,5}"); QString str = "Length: 36 inches 22.33.44.55:99 dfsf sdfdgs sdgsdg s4343 99.00.99.77:99 34534. 343434 11.23.45.67:8888 // 43454.. ..344"; QStringList list; int pos = 0; while ((pos = rx.indexIn(str, pos)) != -1) { list << rx.cap(0); pos += rx.matchedLength(); } for(int i = 0; i < list.size(); i++) { ui->textEdit->append(list.at(i).toLocal8Bit().constData()); MessageBoxA(0, list.at(i).toLocal8Bit().constData(), 0, 0); }