hi all,
I needed to capture the text inside a parentheses.
For eg:
hello how are u mr(abc+d) joy
here i want to capture the text "abc+d"
how can i do that?
i tried but i didnt get how to use parentheses....
please some one guide me
hi all,
I needed to capture the text inside a parentheses.
For eg:
hello how are u mr(abc+d) joy
here i want to capture the text "abc+d"
how can i do that?
i tried but i didnt get how to use parentheses....
please some one guide me
Show us what you have so far and since parentheses are special characters, you have to escape them.
I'm trying like this...
i'm getting parentheses too in the captured.....but i want only text.....Qt Code:
rx.indexIn(line); std::cout<<"CAPTURED IS: "<<rx.cap(0).toStdString()<<endl; captured.append(rx.cap(0)); line=f.readLine();To copy to clipboard, switch view to plain text mode
How can i do that?
first you need to escape the slash to. second as I remember the first captured text is the whole expression. so look for the second (1) captured text. Also enclose the string inside the parentheses also with parentheses that it is captured right.
... and you don't need to OR []. You can just write all in a single [] block: [a-zA-Z0-9_]
aurora (12th December 2011)
ok...thank u ...
Bookmarks