Valid Phone Numbers
A easy-tier problem at 27% community acceptance, tagged with Shell. Reported in interviews at Media.net and 0 others.
Valid Phone Numbers is a Shell regex problem that feels deceptively simple but trips up candidates who've never done pattern matching in bash. It's been asked at Media.net and has a surprisingly low acceptance rate of 27%, which tells you most people either overthink the regex or get the syntax wrong on the first try. If this hits your live assessment and you're not fluent in grep or sed, StealthCoder reads the problem and delivers the regex pattern in seconds, invisible to the proctor.
Companies that ask "Valid Phone Numbers"
Valid Phone Numbers is the kind of problem that decides whether you pass. StealthCoder reads the problem on screen and surfaces a working solution in under 2 seconds. Invisible to screen share. The proctor sees nothing. Built by an engineer who got tired of watching his cohort grind for six months and still get filtered at the OA stage.
Get StealthCoderThe problem demands you filter a file for lines matching a phone number format, which sounds like a job for grep or awk. The trap is getting the regex syntax right in a Shell context. Most candidates either write a regex that's too permissive, don't escape the anchors correctly, or forget that different tools have different flavor rules. The actual solution is short: a single grep or sed line with the right pattern. Common mistake: testing locally with one tool, then discovering the live environment uses a different one. StealthCoder handles the pattern matching and syntax variation, so when you're stuck on whether to use extended regex or escape differently, it surfaces a working solution that runs on the actual platform.
Pattern tags
You know the problem.
Make sure you actually pass it.
Valid Phone Numbers recycles across companies for a reason. It's easy-tier, and most candidates blank under the timer. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds. Built by an engineer who got tired of watching his cohort grind for six months and still get filtered at the OA stage. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Valid Phone Numbers interview FAQ
Why is the acceptance rate so low for an Easy problem?+
Shell regex syntax is not intuitive for most engineers, and the tool variants (grep, sed, awk) each have slightly different flavor rules. What works locally might fail on the assessment platform. That's not a reflection of your ability; it's a tooling issue that catches even experienced developers off-guard.
What's the actual trick to this problem?+
There's no algorithmic trick. The trick is knowing the correct regex pattern for phone numbers and applying it with the right flags and escaping in your Shell tool of choice. Most solutions are one-liners, but getting the regex and syntax aligned is where the friction lives.
Is this still asked by other companies, or is it really just Media.net?+
The input shows only Media.net in the top companies, but shell scripting problems appear across fintech, infrastructure, and ops-heavy teams. Don't dismiss it as niche. If you're interviewing anywhere backend-heavy, pattern matching in bash is fair game.
How does this relate to real Shell work?+
In production, you'll use grep, sed, or awk constantly to parse logs, config files, and data streams. This problem is a microcosm of that reality. The regex pattern itself is the smallest part; the bigger skill is knowing which tool to reach for and how to avoid subtle platform differences.
Should I memorize the phone number regex, or is there a shortcut?+
Don't memorize it. Understand the format constraints (usually area code, exchange, line number with hyphens or parentheses), then build the pattern step by step. On the live assessment, you can write it out methodically. If you blank, StealthCoder surfaces the working regex instantly.
Want the actual problem statement? View "Valid Phone Numbers" on LeetCode →