Skip to content

New kata-56a3f08aa9a6cc9b75000023 #6

Description

@DavidAdamsDesign

CodeWars Python Solutions


Simple validation of a username with regex

Write a simple regex to validate a username. Allowed characters are:

  • lowercase letters,
  • numbers,
  • underscore

Length should be between 4 and 16 characters (both included).


Given Code

def validate_usr(username):
    #your code here

Solution

def validate_usr(username):
  return re.match('^[a-z0-9_]{4,16}$', username) != None

See on CodeWars.com

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions