这是indexloc提供的服务,不要输入任何密码

rfc_6531 1.0.0 copy "rfc_6531: ^1.0.0" to clipboard
rfc_6531: ^1.0.0 copied to clipboard

Email address regular expression as close as possible to the specification in RFC 6531.

RFC 6531 Email address regular expression. #

Email address regular expression as close as possible to the specification in RFC 6531.

For more information on current limitations and detailed overview of used Named Capture Groups refer to the original GitHub Gist.

⚠️ Found a bug? #

If you find a bug, please submit a PR containing a fix or file an issue with the problematic email and justification for why it should be compliant or non-compliant.

Validating email #

import 'package:rfc_6531/rfc_6531.dart' as rfc_6531;

void main() {
  print(rfc_6531.regExp.hasMatch('user@example.com'));
  print(rfc_6531.regExp.hasMatch('not-an-email'));
}

Named Capture Groups #

Used Named Capture Groups used are accessible via Groups class, with their names being accesing via GroupNames.

import 'package:rfc_6531/rfc_6531.dart' as rfc_6531;

void main() {
  final match = rfc_6531.regExp.allMatches('user@example.com').first;
  print(match.namedGroup(rfc_6531.GroupNames.localPart));
  print(match.namedGroup(rfc_6531.GroupNames.domain));
}

Support #

Buy Me A Coffee

1
likes
150
points
23
downloads

Publisher

verified publishermichaeldark.dev

Weekly Downloads

Email address regular expression as close as possible to the specification in RFC 6531.

Repository (GitHub)

Topics

#validation #email #rfc #rfc-6531

Documentation

API reference

License

MIT (license)

More

Packages that depend on rfc_6531