alphanumericRegex top-level property

RegExp alphanumericRegex
final

Regex to check a string contains only letters or digits Note that spaces are counted as alphanumeric

For example:

  • alphanumericRegex.hasMatch('6+bird') -> false
  • alphanumericRegex.hasMatch('move 21') -> true
  • alphanumericRegex.hasMatch('switch4.1') -> true

Implementation

final alphanumericRegex = RegExp(r'^[\w\d. ]+$');