I don't understand the "[(]" and "[)]" parts of the regex. I guess you did that to avoid this being interpreted as capturing group. If so, I recommend to not do this and instead to simply use "someregex" + Pattern.quote("(") + "someotherregex". This makes regular expressions _much_ more readable than inserting escape sequences everywhere. The same is true for the first part, which could be written as Pattern.quote("pocketquery.png"), if I get it right.