Short answer: for a username of 3–16 letters, digits or underscores, the pattern is ^[A-Za-z0-9_]{3,16}$. The ^ and $ make the whole field have to match, the class lists what may appear, and {3,16} is the length rule — drop any of the three and the pattern accepts something it should not.
Why anchors are the part people forget
Without ^ and $ the pattern matches a fragment, so[A-Za-z0-9_]{3,16} happily accepts not a valid username! because a run of valid characters sits inside it. Anchoring turns a search into a validation, and the page warns whenever one of the two is missing.
Worked example
A six-digit PIN is ^\d6$, and the same rule through the builder is digits only, exactly six, both anchors. The class route spells the digits as [0-9] — equivalent, and easier to read when the field also allows letters. Leading zeros survive either way, which is why a PIN is matched as text and never parsed as a number.
What this generator will not do
It will not invent a pattern for an arbitrary English sentence, because a pattern assembled from guesswork cannot be audited. If the goal is a field type the presets do not cover, build the character and length rules here, then open the regex tester to check the matches and groups it produces.