Extracting phone number from string

前端 未结 3 1993
小鲜肉
小鲜肉 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:05

    To find number in any given format You can use use libphonenumber and findNumbers function.

    0 讨论(0)
  • 2021-01-23 21:11

    Assuming your regular expression works as it should, you should take a look at this regex tutorial from Sun.

    0 讨论(0)
  • 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));
    }
    
    0 讨论(0)
提交回复
热议问题