7 kyu

Is that a real phone number? (British version)

686 of 1,383lucyrose93

Description:

Congratulations! That Special Someone has given you their phone number.

But WAIT, is it a valid number?

Your task is to write a function that verifies whether a given string contains a valid British mobile (cell) phone number or not.

  • If the string is a valid UK number, return "In with a chance".

  • If it is invalid, or if you're given an empty string, return "Plenty more fish in the sea".

A number can be valid in the following ways:

  1. Here in the UK, mobile numbers begin with "07" followed by 9 other digits, e.g. "07454876120".

  2. Sometimes the number is preceded by the country code, the prefix "+44", which replaces the "0" in ‘07’, e.g. "+447454876120".

  3. And sometimes you will find numbers with dashes in-between digits or on either side, e.g. "+44--745---487-6120" or "-074-54-87-61-20-". As you can see, dashes may be consecutive.

Good Luck Romeo/Juliette!

Regular Expressions
Strings
Algorithms

Stats:

CreatedNov 2, 2016
PublishedNov 2, 2016
Warriors Trained2251
Total Skips29
Total Code Submissions7414
Total Times Completed1383
JavaScript Completions686
PHP Completions128
CoffeeScript Completions13
Crystal Completions11
Python Completions527
Ruby Completions92
Total Stars31
% of votes with a positive feedback rating92% of 315
Total "Very Satisfied" Votes267
Total "Somewhat Satisfied" Votes43
Total "Not Satisfied" Votes5
Total Rank Assessments8
Average Assessed Rank
7 kyu
Highest Assessed Rank
7 kyu
Lowest Assessed Rank
7 kyu
Ad
Contributors
  • lucyrose93 Avatar
  • jhoffner Avatar
  • Javatlacati Avatar
  • GiacomoSorbi Avatar
  • matt c Avatar
  • ekamaks Avatar
  • Just4FunCoder Avatar
  • saudiGuy Avatar
Ad