Question

I would like to write simple regexp with Qt QRegExp

I want to fetch all substring of a Qstring with table(i, d), without the quotes, with i "hard written" and d representing any integer. And then using cap, to retrieve value for d. I propose

 qREgExp reg ( "table(i,\\s*(\\d+)\\s*)") ;

I cherrish the hope that then

 reg.cap(2)

gives me the d in question here.

How would you put it?

Was it helpful?

Solution

Try to use

qREgExp reg ( "\\btable\\(i,\\s*(\\d+)\\s*\\)" );

with

reg.cap(1) 
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top