If you want to match for the actual ‘+’, ‘. ‘ etc characters, add a backslash( \ ) before that character . This will tell the computer to treat the following character as a search character and consider it for matching pattern. Example : \d+[\+-x\*]\d+ will match patterns like “2+2” and “3*9” in “(2+2) * 3*9”.