Skip to content

Latest commit

 

History

History
23 lines (16 loc) · 727 Bytes

not-very-secure.md

File metadata and controls

23 lines (16 loc) · 727 Bytes

Not very secure 5 Kyu

LINK TO THE KATA - REGULAR EXPRESSIONS STRINGS

Description

In this example you have to validate if a user input string is alphanumeric. The given string is not nil/null/NULL/None, so you don't have to check that.

The string has the following conditions to be alphanumeric:

  • At least one character ("" is not valid)
  • Allowed characters are uppercase / lowercase latin letters and digits from 0 to 9
  • No whitespaces / underscore

Solution

const alphanumeric = string => /^[a-zA-Z0-9]+$/.test(string)