Extracting phone number from string

前端 未结 3 1992
小鲜肉
小鲜肉 2021-01-23 20:20

I am trying to extract phone number in java from the given String i.e. the phone number can be anywhere in the String like [bla bla]TELEPHONE NUMBER[bla bla].Now I

3条回答
  •  北恋
    北恋 (楼主)
    2021-01-23 21:14

    Pattern p = Pattern.compile("^[a-zA-Z]+([0-9]+).*");
    Matcher m = p.matcher("Testing123Testing");
    
    if (m.find()) {
        System.out.println(m.group(1));
    }
    

提交回复
热议问题