QRegExp wrong works
-
Hello all, I have a regexp
@"[^\d]+([^\n]+)"@
an input string
@Someword 1234@
output
@omeword 1234@
I wanna skip string before first number and get all rest, but it dont workWhat's wrong? In boost it works
-
[quote author="bagipro" date="1370516249"]
I wanna skip string before first number and get all rest, but it dont work
[/quote]Does the following do what you want?
@
QRegExp rx("[.|\s](\d)");
rx.setMinimal(true);
...
rx.cap(1); //1234
@ -
It is also funny because it changes Some string to ome word without anything from you. ;)
-
then show the code please where you use the QRegExp ;)
-
butterface, oh yeah :D
i copy it from 2 resources: from program and from code. I will edit first postraven-worx, i write regex-tester
!http://clip2net.com/clip/m0/1370517856-clip-3kb.png(Picture)!So, i find a crutch
@[^\d]+(\d[^\n]+)@ -
But why first regexp did not work?
-
I have a new problem
@(\w+):(\d+)@
@text:123@output
@text@Why "text" only? I wanna get "text" and "123"
-
Hi,
if you want to test and validate your regexp, there is the regexp example in Qt's sources that will help you.
-
Yes, I need to add QRegExp::cap(2). Thanks