id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

regex_phoneNumber


Given a String of some text, return true if it contains a phone number. Let's say a phone number is 3 digits, then 3 digits, then 4 digits, with each group separated by either periods or dashes. A single phone number can't have a period as one separated and a dash as the other or vice versa.


regex_phoneNumber("713-123-4567") → true
regex_phoneNumber("713.123.4567") → true
regex_phoneNumber("713-123.4567") → false

...Save, Compile, Run (ctrl-enter)

public boolean regex_phoneNumber(String text) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Post-solution available

Copyright Nick Parlante 2017 - privacy