7 kyu

Regex validate PIN code

69,782 of 189,387JMurphyWeb

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 Trained317533
Total Skips30756
Total Code Submissions980461
Total Times Completed189387
JavaScript Completions69782
Python Completions81626
C# Completions10776
TypeScript Completions3694
Java Completions19706
CoffeeScript Completions42
Crystal Completions52
Ruby Completions1766
Rust Completions1843
C Completions1802
Factor Completions21
Scala Completions121
Lua Completions44
Groovy Completions9
PHP Completions310
Total Stars2315
% of votes with a positive feedback rating88% of 13874
Total "Very Satisfied" Votes10879
Total "Somewhat Satisfied" Votes2613
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