Regex - Validating a string

-1

Good evening guys, I'm having trouble forming a Regex that validates only the presence of lowercase letters and numbers. If anyone could help, thank you very much! Thanks

    
asked by anonymous 19.12.2017 / 02:31

1 answer

1
^[a-z0-9]*$

Explanation:

  • ^ is the anchor that marks the beginning of a line
  • $ marks the end of a line
  • [a-z0-9] stores within itself the allowed characters to match (letras minusculas e números)
  • * can have, do not have, or have multiple, infinite, that is, any quantity.

for accented

/^[a-z\d\u00E0-\u00FC]*$/

NOTE: \d is same as 0-9

    
19.12.2017 / 02:48