In this post, we will solve Alien Username HackerRank Solution. This problem (Alien Username) is a part of HackerRank Regex series.
Solution – Alien Username – HackerRank Solution
Python
import re pattern = re.compile('^[_\.][0-9]+[a-zA-Z]*[_]?$') n = int(input()) for i in range(n): x = str(input()) if(len(re.findall(pattern,x)) != 0): print("VALID") else: print("INVALID")
Note: This problem (Alien Username) is generated by HackerRank but the solution is provided by CodingBroz. This tutorial is only for Educational and Learning purpose.