Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR DART

dart regex,regex dart

// Here's a regular expression for one or more digits.
var numbers = RegExp(r'd+');

var allCharacters = 'llamas live fifteen to twenty years';
var someDigits = 'llamas live 15 to 20 years';

// contains() can use a regular expression.
assert(!allCharacters.contains(numbers));
assert(someDigits.contains(numbers));

// Replace every match with another string.
var exedOut = someDigits.replaceAll(numbers, 'XX');
assert(exedOut == 'llamas live XX to XX years');
Source by dart.dev #
 
PREVIOUS NEXT
Tagged: #dart #dart
ADD COMMENT
Topic
Name
7+6 =