letter method

FluentRegex letter({
  1. CaseType caseType = CaseType.lowerAndUpper,
  2. Quantity quantity = const Quantity.oneTime(),
})

Example: var regex = FluentRegex().letter(); expect(regex.hasMatch('l'), true); expect(regex.hasMatch('W'), true); expect(regex.hasMatch('5'), false); expect(regex.hasMatch('_'), false); expect(regex.hasMatch('%'), false);

Implementation

FluentRegex letter(
    {CaseType caseType = CaseType.lowerAndUpper,
    Quantity quantity = const Quantity.oneTime()}) {
  switch (caseType) {
    case CaseType.lower:
      return FluentRegex._copyWith(this,
          expression: '$_expression[a-z]$quantity');
    case CaseType.upper:
      return FluentRegex._copyWith(this,
          expression: '$_expression[A-Z]$quantity');
    case CaseType.lowerAndUpper:
      return FluentRegex._copyWith(this,
          expression: '$_expression[a-zA-Z]$quantity');
  }
}