Kira
22nd May 2012, 14:04
Hi,
I need to limit the accepted inputs for a QLineEdit with a QRegExpValidator - but since I am not very familiar with RegExp, I am a bit confused how the RegExp I need would look like..
The Input can be a:
- A single number (eg. "1")
- A range (eg. "10-20")
- A infinite range (eg "10+" or "10-")
- Any combination of these comma-separated (eg "1, 2, 5, 10-30, 50+")
It is not important if the numbers in a comma-separated list make sense or are ascending, this would also be valid "5,2,13,4-20,3+,200-300,50-"
Any idea how I would do this with QRegExpValidator? Or any other nice solution?
Thanks,
Kira
I need to limit the accepted inputs for a QLineEdit with a QRegExpValidator - but since I am not very familiar with RegExp, I am a bit confused how the RegExp I need would look like..
The Input can be a:
- A single number (eg. "1")
- A range (eg. "10-20")
- A infinite range (eg "10+" or "10-")
- Any combination of these comma-separated (eg "1, 2, 5, 10-30, 50+")
It is not important if the numbers in a comma-separated list make sense or are ascending, this would also be valid "5,2,13,4-20,3+,200-300,50-"
Any idea how I would do this with QRegExpValidator? Or any other nice solution?
Thanks,
Kira