Skip to content

Instantly share code, notes, and snippets.

@KanybekMomukeyev
Last active August 23, 2018 07:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KanybekMomukeyev/3b921c31d7923270f5e1f15daeb44f54 to your computer and use it in GitHub Desktop.
Save KanybekMomukeyev/3b921c31d7923270f5e1f15daeb44f54 to your computer and use it in GitHub Desktop.
regex_ex.dart
void main() {
//на вход идет: +996-552-44-23-88
//на выходе: 996552442388
var phoneNumber = "+996-552-44-23-88";
phoneNumber.replaceAll(new RegExp(r"\d+"), "");
print(phoneNumber);
print("test test1 test2".replaceAll(RegExp(r"\s+\b|\b\s"), ""));
phoneNumber = phoneNumber.replaceAll('+', '').replaceAll('-', '');
print(phoneNumber);
var r = RegExp(r'\d+');
var phone__ = "+996-552-44-23-88";
final s = r.allMatches(phone__).map((match) => match[0]).join();
print(s);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment