Prefer continuous ranges as a bank card number.
GitOrigin-RevId: 77eb573fd9580cd79964cecfe879a91178d5a43c
This commit is contained in:
parent
22c1a88a79
commit
d11882c0cb
@ -430,6 +430,10 @@ static vector<Slice> match_bank_card_numbers(Slice str) {
|
||||
auto card_number_begin = ptr;
|
||||
size_t digit_count = 0;
|
||||
while (ptr != end && (is_digit(*ptr) || *ptr == ' ' || *ptr == '-')) {
|
||||
if (*ptr == ' ' && digit_count >= 16 && digit_count <= 19 && digit_count == static_cast<size_t>(ptr - card_number_begin)) {
|
||||
// continuous card number
|
||||
break;
|
||||
}
|
||||
digit_count += static_cast<size_t>(is_digit(*ptr));
|
||||
ptr++;
|
||||
}
|
||||
|
Reference in New Issue
Block a user