extract

fun extract(text: String, length: Int, allowedChars: OtpAllowedChars = OtpAllowedChars.DigitsOnly): String?

Returns an OTP of length when a confident match is found, otherwise null.

Prefers isolated sequences of exactly length characters so phone numbers and long transaction IDs are not split incorrectly.