Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
[Solved] QRegExp for a repeated pattern?
Ailurus last edited by Ailurus
Does QRegExp support matching of repeated patterns? Let's consider a sequence of integers (some of which could be negative), separated by either a comma or a space. For example, 4,6,-28,10.
The QRegExp for an optional minus, 1+ digits and a separator (comma or space) would be
So I'd expect
to be the version for the repeated pattern described above. I know nested regular expressions can be ambiguous, but in this case it is not.
To provide some context — I'm trying to constrain the input for a QLineEdit, using
Unless you're using Qt 4, you should change to QRegularExpression then:
should do what you want.
Hope it helps
Ailurus last edited by
You're welcome !
By the way, you don't have to edit your thread title anymore to mark the thread as solved, juts use the "Topic Tool" button.
Also, while browsing the forum, please consider up-voting answers that helped you. It will make them easier to find for other forum users :)