I have a description text file with content constructed in such manner:
Book title - (number)
Currently user needs to find book title, then reads the book number and looks for the appropriate file (number.txt is a file name of book).
I want to use Regexp class to extract “(number)” expression. My sample code doesn’t work (returns TRUE even if “( )” don’t exist:
Regex r = new Regex("([0-9])");
Could you help me to construct correct RegExp?
You should escape the parentheses:
And if
numbercontains more that one digit, you should add+:Or