Java regex phone number
问题 I am supplying the following regex : ^((?:\+27|27)|0)(\d{9})$ for number of South Africa and want to only return true for numbers that start with +27 or 27 or 0. eg; +27832227765, 27838776654 or 0612323434. I tried using: regexplanet.com and regex test But both return false no matter what I enter (even simple regex). Anybody know what I am doing wrong? 回答1: In Java code, you need to double the backslashes, and in a online tester, the backslashes must be single. Also, it is not necessary to