7 kyu

Regex validate PIN code

68,747 of 186,000JMurphyWeb

Description:

ATM machines allow 4 or 6 digit PIN codes and PIN codes cannot contain anything but exactly 4 digits or exactly 6 digits.

If the function is passed a valid PIN string, return true, else return false.

Examples (Input --> Output)

"1234"   -->  true
"12345"  -->  false
"a234"   -->  false
Regular Expressions
Fundamentals

Stats:

CreatedSep 15, 2015
PublishedSep 15, 2015
Warriors Trained312976
Total Skips30451
Total Code Submissions969170
Total Times Completed186000
JavaScript Completions68747
Python Completions79969
C# Completions10640
TypeScript Completions3596
Java Completions19394
CoffeeScript Completions42
Crystal Completions52
Ruby Completions1747
Rust Completions1802
C Completions1729
Factor Completions21
Scala Completions117
Lua Completions35
Groovy Completions8
PHP Completions243
Total Stars2295
% of votes with a positive feedback rating88% of 13788
Total "Very Satisfied" Votes10805
Total "Somewhat Satisfied" Votes2601
Total "Not Satisfied" Votes382
Ad
Contributors
  • JMurphyWeb Avatar
  • Unnamed Avatar
  • jccrofty30 Avatar
  • GiacomoSorbi Avatar
  • natan Avatar
  • CrazyMerlyn Avatar
  • joecastle Avatar
  • anter69 Avatar
  • Chrono79 Avatar
  • imjasonmiller Avatar
  • kazk Avatar
  • acjoker Avatar
  • Voile Avatar
  • Souzooka Avatar
  • rowcased Avatar
  • hobovsky Avatar
  • username0 Avatar
  • ejini战神 Avatar
  • rcfroggatt786 Avatar
  • akar-0 Avatar
  • tri@ Avatar
  • FranzMartyn Avatar
  • KayleighWasTaken Avatar
  • metatable Avatar
Ad