Community Patterns

Community Library Entry

2

Regular Expression
Created·2015-11-06 14:08
Flavor·ECMAScript (JavaScript)

/
otpauth:\/\/([ht]otp)\/(?:[a-zA-Z0-9%]+:)?([^\?]+)\?secret=([0-9A-Za-z]+)(?:.*(?:<?counter=)([0-9]+))?
/
g
Open regex in editor

Description

This regular expression parses the uri of an one-time password typically masked by a QR Code.

The expression supports the core hotp and totp, name, secret and optional counter (for hotp)

Submitted by Carsten and Craig